This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
# All of these are equivalent | |
def self.myMethod | |
true | |
end | |
def MyClass.myMethod | |
true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Return statements are useless in snippets below, but they can help readability (highlight "end cases" of recursion) | |
# Order of preference : 3, 2/1, 4 | |
# 1) Extra returns make it more obvious what is happening. Maybe a bit verbose | |
def decompose(n) | |
if n == 0 | |
return [] | |
elsif n == 1 | |
return [1] | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable the "Are you sure you want to open this application?" dialog | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
# Disable press-and-hold for keys in favor of key repeat | |
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false | |
# Set a fast keyboard repeat rate | |
defaults write NSGlobalDomain KeyRepeat -int 2 | |
# Decrease the initial time before a keyboard repeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
"env": { | |
"browser": true, | |
"es6": true, | |
"jquery": true | |
}, | |
"extends": "eslint:recommended", | |
"rules": { | |
"indent": [ | |
2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fancy-ctrl-z () { | |
if [[ $#BUFFER -eq 0 ]]; then | |
BUFFER="fg" | |
zle accept-line | |
else | |
zle push-input | |
zle clear-screen | |
fi | |
} | |
zle -N fancy-ctrl-z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew cask install dockertoolbox | |
docker-machine create --driver virtualbox default | |
docker-machine ls | |
eval $(docker-machine env default) | |
Put the exports in this eval in your .zshrc or .bashrc if you use bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make Mixpanel work with Rails Active Job. | |
# Should work with any background job backend. | |
class MixpanelAsyncTracker < Mixpanel::Tracker | |
def initialize | |
super(ENV['MIXPANEL_TOKEN']) do |*message| | |
SendMessage.perform_later(message.to_json) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gbDi() { | |
git branch --sort=-committerdate | remove-colors | egrep -v "master|\*" | cut -c3- > /tmp/branches && \ | |
cp /tmp/branches /tmp/branches-to-keep && \ | |
vim /tmp/branches-to-keep && \ | |
comm -23 <(sort /tmp/branches) <(sort /tmp/branches-to-keep) | xargs 2> /dev/null git branch -D | |
} | |
remove-colors() { | |
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Spring::Watcher::Listen | |
def base_directories | |
%w(app config lib spec) | |
.map { |path| Pathname.new(File.join(root, path)) } | |
end | |
end | |
%w( | |
.ruby-version | |
.rbenv-vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
PROJECT_NAME=$1 | |
main() { | |
display_logo | |
init_project | |
choose_branch |
OlderNewer