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
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'rubygems' | |
require 'oauth2' | |
require 'sinatra' | |
require 'json' | |
API_KEY = your_api_key | |
API_SECRET = your_api_secret |
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
class Person | |
attr_accessor :first_name, :last_name | |
def initialize(attributes=nil) | |
@first_name = attributes[:first_name] | |
@last_name = attributes[:last_name] | |
end | |
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
class CreateArticles < ActiveRecord::Migration | |
self.up | |
create_table :articles do |t| | |
t.string :title | |
t.text :body | |
t.string :type | |
t.timestamps | |
end | |
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
$ rails console | |
ruby-1.9.3-p0 :001 > user = User.new | |
=> #<User id: nil, username: nil, password_digest: nil, created_at: nil, updated_at: nil> | |
ruby-1.9.3-p0 :002 > user = User.new username: 't.baba', password: 'hogehoge', password_confirmation: 'hogehoge' | |
=> #<User id: nil, username: "t.baba", password_digest: "$2a$10$HaXYndWU/kgCYopLf5nyb.PnX2QN0BQeKjECuoreZ2qO...", created_at: nil, updated_at: nil> | |
ruby-1.9.3-p0 :003 > user.save! | |
Binary data inserted for `string` type on column `password_digest` | |
=> true | |
ruby-1.9.3-p0 :005 > user.authenticate 'hoge' | |
=> 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
@client = Octokit::Client.new(login: YOUR_ACCOUNT_NAME, password: YOUR_PASSWORD) | |
@account = @client.user | |
@repos = @client.repos.select{|r| !r.private } |
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
gem 'omniauth' | |
gem 'omniauth-twitter' |
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
puts 'hoge' |
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
require 'rack' | |
class Hello | |
def call(env) | |
[200, {'Content-Type' => 'text/plain'}, ['Hello, Nginx!']] | |
end | |
end | |
run Hello.new |
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
# -*- encoding: utf-8 -*- | |
Gem::Specification.new do |s| | |
s.name = 'parallel_assets_compiler' | |
s.version = '0.2.0' | |
s.platform = Gem::Platform::RUBY | |
s.author = 'Jørgen Orehøj Erichsen' | |
s.email = 'joe@erichsen.net' | |
s.summary = 'Compile assets in parallel' | |
s.description = 'Compile assets in parallel to speed up deployment' |
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
Gem::Specification.new do |gem| | |
gem.name = "all_or_nothing" | |
gem.version = '0.0.1' | |
gem.authors = ["Tatsuro Baba"] | |
gem.email = ["harakirisoul@gmail.com"] | |
gem.description = %q{TODO: Write a gem description} | |
gem.summary = %q{TODO: Write a gem summary} | |
gem.homepage = "https://gist.github.com/4543857" | |
gem.files = ['all_or_nothing.rb'] |
OlderNewer