% rails new demoapp
% cd demoapp
% rails g scaffold post title:string body:text published_at:datetime draft:boolean
% rake db:migrate
class Post < ActiveRecord::Base
validates :title, :presence => true
validates :body, :presence => true
| class DevisePreview < ActionMailer::Preview | |
| def confirmation_instructions | |
| Devise::Mailer.confirmation_instructions(User.new, Devise.friendly_token[0,20]) | |
| end | |
| end |
| module Shoulda | |
| module Matchers | |
| module ActiveRecord | |
| def have_store_accessor(key) | |
| HaveStoreAccessor.new(key) | |
| end | |
| class HaveStoreAccessor | |
| def initialize(key) | |
| @key = key |
| RUBYOPT="-r rubygems" rbenv exec bundle install --path vendor/bundle |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>homebrew.mxcl.jenkins</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>/usr/bin/java</string> | |
| <string>-Dfile.encoding=UTF-8</string> |
| #!/bin/bash -e | |
| NAME="YOUR JAPANESE LAST NAME" | |
| DATE=`date '+%Y-%m-%d'` | |
| URL="https://airshq.atlassian.net/wiki/pages/createblogpost.action?spaceKey=AIRS&title=$DATE+$NAME" | |
| open $URL |
| module Foo | |
| def self.included(base) | |
| base.class_eval do | |
| before_filter :admin_required | |
| end | |
| end | |
| end |
| git remote add origin my://server/repo.git | |
| git config branch.master.remote origin | |
| git config branch.master.merge refs/heads/master |
| MKCoordinateRegion region = mapView.region; | |
| CLLocationCoordinate2D topLeftCoordinate = | |
| CLLocationCoordinate2DMake(region.center.latitude + (region.span.latitudeDelta / 2.0), | |
| region.center.longitude - (region.span.longitudeDelta / 2.0)); | |
| CLLocationCoordinate2D bottomRightCoordinate = | |
| CLLocationCoordinate2DMake(region.center.latitude - (region.span.latitudeDelta / 2.0), | |
| region.center.longitude + (region.span.longitudeDelta / 2.0)); | |
| MKMapPoint topLeftMapPoint = MKMapPointForCoordinate(topLeftCoordinate); |
| KEY = "YOUR_TWITTER_APP_CONSUMER_KEY" | |
| SECRET = "YOUR_TWITTER_APP_CONSUMER_SECRET" | |
| IGNORE_SOURCES = ["hamamatsurb-bot"] |