$ rails g model User
belongs_to
has_one
| /* | |
| * Minimal classList shim for IE 9 | |
| * By Devon Govett | |
| * MIT LICENSE | |
| */ | |
| if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') { | |
| Object.defineProperty(HTMLElement.prototype, 'classList', { | |
| get: function() { |
| # Public: Template to render views outside the context of a controller. | |
| # | |
| # Useful for rendering Rails 2.3.x views in rake tasks or background jobs when a | |
| # controller is unavailable. | |
| # | |
| # Examples | |
| # | |
| # template = OfflineTemplate.new(:users) | |
| # template.render("users/index", :layout => false, :locals => { :users => users }) | |
| # |
| alias server='open http://localhost:8000 && python -m SimpleHTTPServer' |
| require 'fileutils' | |
| namespace :db do | |
| desc 'pull the production PostgreSQL database into the development SQLite' | |
| task :pull do | |
| Rake::Task['db:download_pg_dump'].invoke | |
| Rake::Task['db:optimze_pg_dump_for_sqlite'].invoke | |
| Rake::Task['db:recreate_with_dump'].invoke | |
| end |
| -If you're using a Mac terminal, take a look at [this article](http://www.21croissants.com/howto/fix-forward-delete-key-on-snow-leopard-for-irb). | |
| +#### iTerm2 | |
| + | |
| +* Go to iTerm > Preferences... > Keys | |
| +* Add a Global Shortcut Key | |
| +* Type the `delete` key as Shortcut | |
| +* Select Send Hex Codes as Action and type 0x004 | |
| +* Click on `OK` and you're good to go | |
| + | |
| +#### iTerm |
| #!/usr/bin/env ruby | |
| # download (Works for me™) | |
| # | |
| # A simple & fast download script that utilizes em-http-request as http client | |
| # Usage: download <url> | |
| # | |
| # The filename is determined either by the GET path or by the Content-Disposition response header if given. | |
| # The script will check if there is an existing file and try to resume the download if possible. | |
| # | |
| # Sometimes writing Spaghetti code can be a lot of fun. Don't use it, I do not want to maintain this script. |
| !!! Strict | |
| %html{:xmlns => 'http://www.w3.org/1999/xhtml'} | |
| %head | |
| %meta{'http-equip' => 'Content-Type', :content => 'text/html; charset=utf-8'} | |
| %meta{:name => 'viewport', :content => 'widt=device-width, initial-scale=1.0'} | |
| %title= subject | |
| :css | |
| /* Based on The MailChimp Reset INLINE: Yes. */ | |
| /* Client-specific Styles */ | |
| #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */ |
| #!/usr/bin/env ruby | |
| # Put this file in the root of your Rails project, | |
| # then run it to output the SQL needed to change all | |
| # your tables and columns to the same character set | |
| # and collation. | |
| # | |
| # > ruby character_set_and_collation.rb | |
| DATABASE = '' |
| #!/bin/bash | |
| # from | |
| # http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html | |
| convert source-WxW.png -resize 256x256 -transparent white favicon-256.png | |
| convert favicon-256.png -resize 16x16 favicon-16.png | |
| convert favicon-256.png -resize 32x32 favicon-32.png | |
| convert favicon-256.png -resize 64x64 favicon-64.png | |
| convert favicon-256.png -resize 128x128 favicon-128.png |