Here I'll show you
- How to override devise registrations_controller(related to create/update user account)
- How to change redirect path after updating user
# encoding: UTF-8 | |
# | |
# $ rake checkout new_branch_name | |
# | |
# Via https://gist.github.com/jonlemmon/4076864 | |
# | |
# 1. Roll back any migrations on your current branch which do not exist on the | |
# other branch | |
# 2. Discard any changes to the db/schema.rb file | |
# 3. Check out the other branch |
# Destructuring assignment in Ruby | |
# http://po-ru.com/diary/destructuring-assignment-in-ruby/ | |
numbers = [ 1, 2, 3, 4, 5] | |
=> [1, 2, 3, 4, 5] | |
# Destructuring assignment | |
a, b, c = numbers |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
gg_replace() { | |
if [[ "$#" == "0" ]]; then | |
echo 'Usage:' | |
echo ' gg_replace term replacement file_mask' | |
echo | |
echo 'Example:' | |
echo ' gg_replace cappuchino cappuccino *.html' | |
echo | |
else | |
find=$1; shift |
<?php | |
$salt = genrandom(40); | |
$seed = genrandom(29, "0123456789"); | |
echo "\tConfigure::write('Security.salt', '$salt');\n"; | |
echo "\tConfigure::write('Security.cipherSeed', '$seed');\n"; | |
function genrandom($len, $salt = null) { | |
if (empty($salt)) { |