Skip to content

Instantly share code, notes, and snippets.

@shashankmehta
shashankmehta / setup.md
Last active January 7, 2024 11:57
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@vega113
vega113 / check-balances.js
Created September 29, 2016 07:31
Check balances in bittrex
var bittrex = require('./node.bittrex.api.js');
bittrex.options({
'apikey': '',
'apisecret': '',
'stream': false,
'verbose': false,
'cleartext': false
});
@gnachman
gnachman / iterm.scpt
Last active April 8, 2023 23:42
Replace /Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/iterm.scpt with this.
set itermRunning to (application "iTerm" is running)
set scriptPath to quoted form of POSIX path of ((path to me as text) & "::" & "start.sh")
set user_shell to do shell script "dscl /Search -read /Users/$USER UserShell | awk '{print $2}'"
tell application "iTerm"
activate
if not (exists window 1) or (itermRunning = false) then
reopen
end if
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@mlegenhausen
mlegenhausen / ds
Created March 5, 2014 11:24
Get directory size via the command line on mac os and linux in a human readable format
#!/bin/sh
find $1 -type f -print0 | xargs -0 stat -f'%z' | awk '{b+=$1} END {print b}' | awk '{ sum=$1 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}'
function parse_git_branch {
git_status="$(git status 2> /dev/null)"
pattern="^# On branch ([^${IFS}]*)"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="*"
fi
# add an else if or two here if you want to get more specific
if [[ ${git_status} =~ ${pattern} ]]; then
branch=${BASH_REMATCH[1]}