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
######################################### | |
# Very basic rack application showing how to use a router based on the uri | |
# and how to process requests based on the HTTP method used. | |
# | |
# Usage: | |
# $ rackup rack_example.ru | |
# | |
# $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas | |
# $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas | |
# $ curl localhost:9292/ideas |
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
a = tag(:b) | |
=> "<b />" | |
rubinius-2.0.0dev :015 > a.html_safe? | |
=> true | |
rubinius-2.0.0dev :016 > a.dup.html_safe? | |
=> nil |
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
Role.count | |
(0.5ms) SELECT COUNT(*) FROM "roles" | |
=> 0 | |
1.8.7 :037 > Role.last | |
Role Load (0.5ms) SELECT "roles".* FROM "roles" ORDER BY "roles"."id" DESC LIMIT 1 | |
=> nil | |
1.8.7 :038 > Role.create!(:name => 'php_committer') | |
(0.2ms) BEGIN | |
Role Exists (0.4ms) SELECT 1 FROM "roles" WHERE "roles"."name" = 'php_committer' LIMIT 1 | |
SQL (0.7ms) INSERT INTO "roles" ("created_at", "description", "name", "title", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["created_at", Fri, 01 Jun 2012 01:15:04 MSK +04:00], ["description", nil], ["name", "php_committer"], ["title", nil], ["updated_at", Fri, 01 Jun 2012 01:15:04 MSK +04:00]] |
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
mysql: SHOW TABLES | |
postgresql: \d | |
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'; | |
mysql: SHOW DATABASES | |
postgresql: \l | |
postgresql: SELECT datname FROM pg_database; | |
mysql: SHOW COLUMNS | |
postgresql: \d table |
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 apt-get update && sudo apt-get upgrade | |
sudo apt-get install build-essential | |
sudo mount /dev/cdrom /media/cdrom | |
cd /media/cdrom && sudo sh ./VBoxLinuxAdditions.run |
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
mv ~/Library/Application\ Support/Skype ~/Dropbox/ | |
ln -s ~/Dropbox/Skype ~/Library/Application\ Support/Skype |
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
# encoding: utf-8 | |
# needs to be installed 7za, pgdbf | |
namespace :kladr do | |
PATH = 'tmp/kladr' | |
def import_options(database=nil) | |
host = ActiveRecord::Base.configurations[Rails.env]['host'] | |
user = ActiveRecord::Base.configurations[Rails.env]['username'] | |
host &&= "--host=#{host}" |
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
puts <<-SNOWMAN | |
________ | |
* [________] . * | |
* . |________| / . * | |
| |/ | |
* ========= | |
* ______________ | |
* |||||| / \\ | |
||> || ( 0 0 ) . | |
. ||- | | O | |
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
<?php | |
/* | |
* Podcast URL Extractor | |
* implemented at http://itunes.so-nik.com | |
* | |
* All code has been re-written by lasavior. | |
* Original code & inspiration from Michael Sitarzewski, zerologic.com | |
* | |
* Ex: http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/viewPodcast?id=269238657 |
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
# current | |
class AddAuthorIdToBooksTable < ActiveRecord::Migration | |
def change | |
add_column :books, :author_id, :integer | |
add_index :books, :author_id | |
end | |
end | |
# thought | |
class AddAuthorIdToBooksTable < ActiveRecord::Migration |