View on GitHub

Dev Docs

Useful things for development that are difficult to remember

List of useful things for Mac Development

ATOM

atom --clear-window-state

GIF’s

Install gifify

gifify {PATH_TO_INPUT} -o {PATH_TO_OUTPUT}

GIT

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
git push origin master -f



git fetch origin
git -B {branch-name}
git reset --hard origin/{branch-name}



git push origin --delete {branch_name}



git checkout -b <my_new_branch> <remote>/<branch_name>



git remote set-url origin git://new.url.here



git update-index --skip-worktree src/config/SECRETS.js



git branch -m master old-master
git branch -m seotweaks master
git push -f origin master



git branch | grep -v "master" | xargs git branch -D

iOS

xcodebuild --help

Does the above fail? Try this: xcode => preferences => locations => Command Line Tools and select your version

security find-identity -v -p codesigning



/{root}/Library/MobileDevice/Provisioning Profiles

then less {file} will give you enough info to determine the proper file

xcodebuild -workspace {PROJECT_NAME}.xcworkspace -scheme {PROJECT_NAME} -configuration Release -archivePath ${archivePath} archive -quiet -sdk iphoneos



xcodebuild -exportArchive -archivePath ${archivePath} -exportPath ${exportPath} -exportOptionsPlist ${exportOptionsPlistPath}
<plist version="1.0">
<dict>
  <key>compileBitcode</key>
  <false/>
  <key>method</key>
  <string>enterprise</string>
  <key>signingCertificate</key>
  <string>{UUID}</string>
  <key>provisioningProfiles</key>
  <dict>
    <key>{bundle_ID}</key>
    <string>{UUID}</string>
  </dict>
  <key>signingStyle</key>
  <string>manual</string>
  <key>stripSwiftSymbols</key>
  <true />
  <key>teamID</key>
  <string>{TEAM_ID}</string>
</dict>
</plist>



itms-services://?action=download-manifest&url={URL_TO_MANIFEST_PLIST.plist}



openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts

React-Native

./node_modules/.bin/react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/{PROJECT_NAME}/main.jsbundle



cd android && ./gradlew clean && ./gradlew assembleRelease && cd ../

Heroku

heroku pg:backups:capture
heroku pg:backups:download
heroku rollback v{whatever version} -r {whatever you call your remote}

git remote -v   <= will list remotes

Postgres

pg_restore --verbose --clean --no-acl --no-owner -h localhost -d {DATABSE_NAME} {PATH_TO_DUMP_FILE}



postgres -D /usr/local/var/postgres



TO COMPLETELY RESET POSTGRESQL LOCALLY

Chrome

Redis

This is nice:

/*  Some Constants File */
export const REDIS_PORT_OR_URL = isDev
  ? Number.parseInt(process.env.REDIS_PORT, 10)
  : process.env.REDISCLOUD_URL;

/* Some other file */
import redis from "redis";

import { REDIS_PORT_OR_URL } from "../constants";

const client = redis.createClient(REDIS_PORT_OR_URL, { no_ready_check: true });

export default client;



"start:redis": "concurrently --kill-others-on-fail \"yarn start:redis:server\" \"yarn start:redis:commander\" \"wait-on http://localhost:5002 && yarn open:chrome:redis:commander\""

"start:redis:server": "redis-server"

"start:redis:commander": "./node_modules/.bin/redis-commander -p 5002 "

"open:chrome:redis:commander": "open http://localhost:5002/"

NPM

npm config list



npm set {key} {value}



.npmrc in root overrides local settings

always-auth = true /* usually false */
metrics-registry = https://registry.npmjs.org/
registry = https://registry.npmjs.org/

MONGO

brew update
brew install mongodb
sudo mkdir -p /data/db
sudo chmod 0755 /data/db && sudo chown $USER /data/db
mongo
* Within Mongo Shell
```bash
show dbs  // will list localhost dbs
```



mongodb://<username>:<password>@<url>:<port>/<database>

mongodump -h <url>:<port> -d <database> -u <username> -p <password>

mongodump will create a folder, within the current directory, dump/<database>/

mongorestore -d <dbname, same as the one dropped> <path to dump database dump/<database>/>

MYSQL

mysql -u root -p
mysql> SET GLOBAL innodb_fast_shutdown = 1;
mysql> use mysql;
mysql> update user set plugin='mysql_native_password' where user='root';
mysql_upgrade -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'



Rando

ifconfig

To stgream and save so to a file run

yarn start | tee filename.log

To debug dns and not found errors

8.8.8.8 is google’s dns and it should give you the ip of the end server

nslookup domain 8.8.8.8

How to set transparency with hex value

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #00000066.

All hex value from 100% to 0% alpha: