sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-x.x.plist
sudo rm -f /Library/LaunchDaemons/com.edb.launchd.postgresql-x.x.plist
sudo cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/
sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-x.x.plist
sudo rm -f /Library/LaunchDaemons/com.edb.launchd.postgresql-x.x.plist
sudo cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/
# Automatically adds branch name and description to every commit message. | |
# | |
DESCRIPTION=$(git config branch."$NAME".description) | |
if ! [[ $@ == *HEAD* ]] then | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
echo "$NAME"': '"`cat "$1"`" > "$1" | |
fi | |
if [ -n "$DESCRIPTION" ] then |
AllCops: | |
RunRailsCops: true | |
Style/Encoding: | |
Enabled: false | |
Style/AsciiComments: | |
Enabled: false | |
Lint/AssignmentInCondition: |
class LunchList | |
NAMES = %i(DimaS DimaG Denis SergeyStat SergeyAdm Oleg Alena).shuffle | |
MIN_EATERS = 3 | |
MAX_EATERS = 4 | |
def generated_list | |
decisions = {} | |
NAMES.map do |name| | |
decisions[name] = rand(0..1).zero? ? 'wait' : 'go!' | |
end |
class SessionCookieGenerator | |
def self.generate user_obj | |
new(user_obj).generate | |
end | |
def initialize user_obj | |
@user = user_obj | |
@cookie = {} | |
@session = {'rack.session' => {}} | |
end |
-- View Current Lock | |
SELECT c.relname, l.mode, l.granted, l.pid FROM pg_locks as l JOIN pg_class as c on c.oid = l.relation; | |
-- UTF-8 text search by index | |
create index on <table> (<column> text_pattern_ops); | |
-- Generate nodes path | |
create table <table> as select i, format('/%s/%s/', (random() * 10), (random() * 10)) from generate_series(1,100000); | |
-- Create extension |
#require 'rubygems' | |
require 'pp' | |
#require 'ap' # Awesome Print | |
class Object | |
# expects [ [ symbol, *args ], ... ] | |
def recursive_send(*args) | |
args.inject(self) { |obj, m| obj.send(m.shift, *m) } | |
end | |
end |
with a hat tip to Sublime Text 2 Shortcuts
⌘; | autocomplete |
⌘⌥B | instant replay |
⌘⌥E | search across all tabs |