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 sync && echo 3 | sudo tee /proc/sys/vm/drop_caches |
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
t = Table.arel_table | |
Table.where(t[:name].matches('%findme%')) |
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
First, move the cursor to the first char of the first line in block code you want to comment, then type: | |
CTRL + V | |
then vim will go in to VISUAL BLOCK mode. Use j to move the cursor down until you reach the last line of your code block. Then type: | |
Shift + I | |
now vim go to INSERT mode and the cursor is at the first char of the firts line. Finally, type # then ESC and the code block is now commented. | |
To decomment, do the same things but instead of type Shift + I, you just type x to remove all # after highlight them in VISUAL BLOCK mode. |
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
# prepare string | |
d = "foo\u00A0\bar" | |
=> "foo \bar" | |
# ruby >= 1.9 | |
d.gsub("\u00A0", "") | |
=> "foo\bar" | |
# ruby 1.8 | |
d.gsub(/\302\240/,"") |
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
# remote list | |
git remote -v | |
# add heroku app remote | |
heroku git:remote --app app_name | |
git remote -v | |
# heroku https://git.heroku.com/app_name.git | |
# rename local remote |
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 https://devcenter.heroku.com/articles/git#deploying-code | |
$ git push heroku yourbranch:master |
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
# add as external resource the following library: | |
https://getfirebug.com/firebug-lite-debug.js | |
# then use console.log() into javascript panel |
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
_ |
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
# list all databases | |
\list or \l | |
# list all tables in the current database | |
\dt | |
# switch databases: | |
\connect 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
# edit | |
/var/lib/pgsql/data/pg_hba.conf | |
# change authentication methods from ident to md5 |