$ rails g model User
belongs_to
has_one
# sinatra でのリダイレクト設定 | |
# hoge/ のような '/' 終わりを '/' 無しへリダイレクト | |
# ただし、 http://example.com の場合は末尾 '/' が付く | |
get %r{^(.+)/$} do |c| | |
redirect c, 303 | |
end |
http://fladdict.net/blog/2011/02/auto-kerning.html | |
グローバル汚染を無くしたのと、jQueryらしくかけるようにしました。 | |
// 引数なしの場合デフォルトのカーニングが摘要される。 | |
$(selector).FLAutoKerning(); | |
// 引数を入れた場合、そのカーニングが摘要される。 | |
$(selector).FLAutoKerning(myKerningInfo); | |
ライセンスは元のFLAutoKerning.jsを継承します。 |
#!/usr/bin/env macruby | |
# | |
# MacRubyで画面グリッチをフルスクリーン表示する | |
# | |
# http://twitter.com/negipo/status/67572370247913473 | |
# | |
# ## Usage | |
# | |
# ./glitch.rb | |
# |
module Sunspot | |
module DataMapper | |
def self.included(base) | |
base.class_eval do | |
alias new_record? new? | |
end | |
base.extend Sunspot::Rails::Searchable::ActsAsMethods | |
Sunspot::Adapters::DataAccessor.register(DataAccessor, base) |
.highlight { | |
background-color: #efefef; | |
padding: 7px 7px 7px 10px; | |
border: 1px solid #ddd; | |
-moz-box-shadow: 3px 3px rgba(0,0,0,0.1); | |
-webkit-box-shadow: 3px 3px rgba(0,0,0,0.1); | |
box-shadow: 3px 3px rgba(0,0,0,0.1); | |
margin: 20px 0 20px 0; | |
overflow: hidden; |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
def consumer | |
OAuth::Consumer.new(TWITTER_CONSUMER_KEY,TWITTER_CONSUMER_SECRET,{:site=>"http://twitter.com" }) | |
end | |
def loginTwitter | |
@req_token = consumer.get_request_token(:oauth_callback=>"http://127.0.0.1:3000/login/twitter/success") | |
session[:request_token] = @req_token.token | |
session[:request_token_secret] = @req_token.secret | |
redirect_to @req_token.authorize_url | |
end |