Skip to content

Instantly share code, notes, and snippets.

View ppworks's full-sized avatar
🏠
Working from home

Naoto Koshikawa ppworks

🏠
Working from home
View GitHub Profile
@ppworks
ppworks / gist:1138503
Created August 10, 2011 22:56
[hack] post to facebook via fb_graph
module FbGraph
class Property
include Comparison
attr_accessor :name, :text, :href
def initialize(attriutes = {})
# override for "can't convert Symbol into Integer"
end
end
@ppworks
ppworks / Guardfile.diff
Created August 26, 2011 12:05
"Could not start Spork server for RSpec" when guard start.
diff --git a/Guardfile b/Guardfile
index 90843a8..6ffae21 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,7 +1,7 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
-guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
+guard 'spork', :wait => 60, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
@ppworks
ppworks / fugos.yml
Created January 5, 2012 04:46
rails:db/seeds.rb
fugos:
-
id: 1
name: 'fugo'
-
id: 2
name: 'fugofugo'
@ppworks
ppworks / spec_helper.rb
Created January 7, 2012 03:08
check ancestors for RSpec
def ancestors_should_include ancestors
describe 'ancestors' do
ancestors.each do |ancestor|
it {subject.class.ancestors.should be_include ancestor}
end
end
end
@ppworks
ppworks / confirmations_controller.rb.diff
Created January 7, 2012 13:33
How to allow user to signup providing email address only(updated)
--- a/app/controllers/confirmations_controller.rb
+++ b/app/controllers/confirmations_controller.rb
@@ -1,20 +1,19 @@
class ConfirmationsController < Devise::ConfirmationsController
def show
@user = User.find_by_confirmation_token(params[:confirmation_token])
- if !@user.present?
- render_with_scope :new
- end
+ head :not_found unless @user.present?
@ppworks
ppworks / hoge.rb
Created January 19, 2012 02:25
rails task template
namespace :hoge do
desc 'fugo'
task :fugo => :environment do
ActiveRecord::Base.logger = Logger.new(STDOUT)
puts Benchmark::CAPTION
Benchmark.bm do |x|
x.report("all\n") {
}
end
end
@ppworks
ppworks / rail_new_3.1_3.2.diff
Created January 22, 2012 05:10
'rails new sample -T' diff between 3.1 and 3.2
diff sample3.1/.gitignore sample3.2/.gitignore
1,5c1,15
< .bundle
< db/*.sqlite3
< log/*.log
< tmp/
< .sass-cache/
---
> # See http://help.github.com/ignore-files/ for more about ignoring files.
> #
@ppworks
ppworks / nginx
Created February 15, 2012 03:04
add nginx configure option "--with-http_gzip_static_module"
require 'formula'
class Nginx < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.0.12.tar.gz'
md5 'd0ceefeb2a68ecb19e78ee894a5b52a3'
devel do
url 'http://nginx.org/download/nginx-1.1.14.tar.gz'
md5 '16d523e395778ef35b49a2fa6ad18af0'
@ppworks
ppworks / gist:1916622
Created February 26, 2012 13:11
install_rails_application_on_ubuntu

vim

sudo aptitude install vim-nox

sshd

sudo vim /etc/ssh/sshd_config
@ppworks
ppworks / .zshrc
Created March 4, 2012 02:48
.zshrc
export LANG=ja_JP.UTF-8
# homebrewを優先
export PATH=~/bin:/usr/local/bin:$PATH
# rvm
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"