I get the gist of this.
This file contains hidden or 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
def ask(question) | |
puts question | |
user_input = gets.chomp | |
end | |
def ask_num(question) | |
ask(question).to_f | |
end |
This file contains hidden or 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
f = 10.5; p "$%.1f" % f |
This file contains hidden or 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
url = 'http://www.google.com/?q=123&y=2950&z=9500&p=950' | |
params = {} | |
query = url.split('?').pop | |
query.split('&').each do |x| y = x.split('='); params[y[0]] = y[1] end |
This file contains hidden or 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
helpers do | |
def db_exec(sql) | |
conn = PG.connect(:dbname =>'DB_NAME', :host => 'localhost') | |
result = conn.exec(sql) | |
conn.close | |
result | |
end | |
end |
This file contains hidden or 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
require 'active_record' | |
ActiveRecord::Base.logger = Logger.new( STDOUT ) | |
ActiveRecord::Base.establish_connection( | |
:adapter => "postgresql", | |
:host => "localhost", | |
:username => "EDIT ME", | |
:password => "", | |
:database => "EDIT ME" |
This file contains hidden or 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
def self::quote_connstr( value ) | |
return "'" + value.to_s.gsub( /[\\']/ ) {|m| '\\' + m } + "'" | |
end |
This file contains hidden or 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
development: | |
adapter: postgresql | |
encoding: unicode | |
database: <%= File.basename(Rails.root) %>_development | |
pool: 5 | |
host: localhost | |
username: <%= ENV['PG_USERNAME'] %> | |
password: | |
test: |
This file contains hidden or 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
doctype html | |
== "<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->" | |
== "<!--[if lt IE 7 ]> <html class=\"ie6\" lang=\"en\"> <![endif]-->" | |
== "<!--[if IE 7 ]> <html class=\"ie7\" lang=\"en\"> <![endif]-->" | |
== "<!--[if IE 8 ]> <html class=\"ie8\" lang=\"en\"> <![endif]-->" | |
== "<!--[if IE 9 ]> <html class=\"ie9\" lang=\"en\"> <![endif]-->" | |
== "<!--[if (gt IE 9)|!(IE)]><!--> <html lang=\"en\"> <!--<![endif]-->" | |
head | |
meta charset="utf-8" |
This file contains hidden or 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
tail -f log/development.log |
OlderNewer