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
items = { | |
'orange' => 'shoes', | |
'pink' => 'skirt', | |
'borwn' => 'socks', | |
'blue' => 'hat' | |
} | |
items.each.with_index(1) do |(color, item), index| | |
puts "#{index}. Please wear your #{color} #{item}." | |
end |
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
development: &development | |
adapter: postgresql | |
database: <%= Rails.application.class.parent_name.underscore %>_development | |
host: localhost | |
pool: 5 | |
timeout: 5000 | |
test: | |
<<: *development | |
database: <%= Rails.application.class.parent_name.underscore %>_test | |
production: |
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
bundle config build.pg --with-pg-include='/Applications/Postgres.app/Contents/Versions/9.3/include/' | |
bundle config build.nokogiri --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/ |
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
CREATE SEQUENCE feedbacks_id_seq; | |
ALTER TABLE feedbacks ALTER COLUMN id SET DEFAULT nextval('feedbacks_id_seq'::regclass); | |
ALTER SEQUENCE feedbacks_id_seq OWNED BY feedbacks.id; | |
select setval('feedbacks_id_seq', (select max(id)+1 from feedbacks), 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
ALTER TABLE my_table ALTER COLUMN my_column DROP DEFAULT; | |
ALTER TABLE my_table ALTER my_column TYPE bool USING CASE WHEN my_column=0 THEN FALSE ELSE TRUE END; | |
ALTER TABLE my_table ALTER COLUMN my_column SET DEFAULT 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
# http://stackoverflow.com/a/9460051/148270 | |
describe SomeController do | |
render_views | |
describe "GET 'index'" do | |
before(:each) do | |
@@response ||= begin | |
get 'index' | |
response | |
end |
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
# enable with: | |
# | |
# - content_for :head do | |
# :javascript | |
# window.enable_home_bookmark = true | |
$ -> | |
if window.enable_home_bookmark && (("undefined" != typeof window.navigator.standalone) && !window.navigator.standalone) && navigator.userAgent.match(/iPad/i) != null | |
$('<div id="home_bookmark" style="position:fixed; top: 60px; left: 155px;" ></div>').appendTo('body').popover( | |
placement: 'bottom' |
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
switch (window.orientation) | |
{ | |
case 0: // Portrait | |
break; | |
case 90: ; // Landscape | |
break; | |
case -90: ; // Landscape counterclockwise | |
break; | |
} |
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
%meta{:content => "yes", :name => "apple-mobile-web-app-capable"}/ | |
%meta{:content => "black", :name => "apple-mobile-web-app-status-bar-style"}/ | |
%meta{:content => "minimum-scale = 1.0, maximum-scale = 1.0, initial-scale = 1.0, user-scalable = no", :name => "viewport"}/ | |
%meta{:name => "format-detection", :content => "telephone=no"} | |
%link{:rel => "apple-touch-icon-precomposed", :href => "/assets/apple-touch-icon-precomposed.png"}/ | |
%link{:rel => "apple-touch-icon-precomposed", :href => "/assets/apple-touch-icon-precomposed-57x57.png", :sizes => "57x57"}/ | |
%link{:rel => "apple-touch-icon-precomposed", :href => "/assets/apple-touch-icon-precomposed-72x72.png", :sizes => "72x72"}/ | |
%link{:rel => "apple-touch-icon-precomposed", :href => "/assets/apple-touch-icon-precomposed-114x114.png", :sizes => "114x114"}/ | |
%link{:rel => "apple-touch-icon-precomposed", :href => "/assets/apple-touch-icon-precomposed-144x144.png", :sizes => "144x144"}/ |
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
# http://www.tsheffler.com/blog/?p=428 | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
# For all responses in this controller, return the CORS access control headers. | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' |
OlderNewer