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
[true, false, 1223, nil].each do |b| | |
[true, false, 5555, nil].each do |c| | |
a = b && c | |
puts "#{b} && #{c} = #{a}" | |
end | |
end | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
true && true = true | |
true && false = false |
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
#!/usr/bin/env bash | |
# See http://gorails.com/setup/ubuntu/13.10 | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL |
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
-- see http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection | |
SELECT | |
pg_terminate_backend(procpid) | |
FROM | |
pg_stat_activity | |
WHERE | |
-- don't kill my own connection! | |
procpid <> pg_backend_pid() | |
-- don't kill the connections to other databases | |
AND datname = 'database_name'; |
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
SELECT parentns.nspname as "parent schema", parent.relname as "parent table", childns.nspname "child schema", child.relname as "child table" | |
FROM pg_catalog.pg_inherits inh | |
INNER JOIN pg_catalog.pg_class as parent ON (inh.inhparent = parent.oid) | |
INNER JOIN pg_catalog.pg_namespace as parentns ON (parent.relnamespace = parentns.oid) | |
INNER JOIN pg_catalog.pg_class as child ON (inh.inhrelid = child.oid) | |
INNER JOIN pg_catalog.pg_namespace as childns ON (child.relnamespace = childns.oid) | |
ORDER BY parent.relname, child.relname; |
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
urlFor = function(url, params) | |
{ | |
url = url || window.location.href || ''; | |
url = url.match(/\?/) ? url : url + '?'; | |
for (var key in params) { | |
var re1 = RegExp( '\\?' + key + '=[^\&$]*(&|$)', 'g' ); | |
var re2 = RegExp( '\&' + key + '=[^\&$]*(&|$)', 'g' ); | |
var replacement = params[key] ? key + '=' + params[key] : ""; |
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
sudo cp /Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib /usr/lib/ | |
sudo cp /Library/PostgreSQL/9.1/lib/libcrypto.1.0.0.dylib /usr/lib/ | |
sudo rm /usr/lib/libssl.dylib | |
sudo rm /usr/lib/libcrypto.dylib | |
sudo ln -s /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib | |
sudo ln -s /usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.dylib | |
gem uninstall pg |