Skip to content

Instantly share code, notes, and snippets.

View kyanny's full-sized avatar

Kensuke Nagae kyanny

View GitHub Profile
@fujimura
fujimura / README.md
Created May 11, 2012 10:05
heroku_config.rake

ローカルのomniauth.ymlにheroku用の設定を書いておいて、

$ rake heroku_config:upload

すればherokuに設定がコピーされます。

@zbskii
zbskii / gist:3699880
Created September 11, 2012 17:08
Ruby allocations
require 'rubygems'
require 'ruby-prof'
RubyProf.measure_mode = RubyProf::ALLOCATIONS
RubyProf.start
1_000_000.times{ Array.new(10) }
result = RubyProf.stop
# Print a flat profile to text
printer = RubyProf::FlatPrinter.new(result)
printer.print(STDOUT)
@kyanny
kyanny / config.ru
Created September 12, 2012 03:40
デモアプリ of Sapporo Ruby Kaigi Pre Event in Tokyo
require 'rack'
class App
def call(env)
html = %Q!<html><body style="margin:0"><img src="http://30d.jp/img/kyanny/public/80a57ec4-fc89-11e1-9cd3-00262d09affa_original.jpg" /></body></html>!
[200, {'content-type' => 'text/html'}, [html]]
end
end
run App.new
@tatsuosakurai
tatsuosakurai / app.js
Created October 8, 2012 06:23
Emberjs Sample
console.log('hi');
window.Todos = Ember.Application.create();
Todos.Todo = Ember.Object.extend({
title: null,
isDone: false
});
Todos.todosController = Ember.ArrayController.create({
content:[],
// NSString* url = [NSString stringWithFormat:@"http://api.twitter.com/1/users/profile_image?size=normal&screen_name=%@", [screenName gtm_stringByEscapingForURLArgument]];
NSString *url = [NSString stringWithFormat:@"http://n.hatena.ne.jp/%@/profile/image?type=face", screenName]; // はてなのURLに変更
#!/usr/bin/env ruby
while ARGF.readline
puts $.
begin
$_.match /./
rescue => e
puts $_
raise e
end
CONFIGURE_OPTS="--with-out-ext=tk,tk/* --with-opt-dir=`brew --prefix openssl`:`brew --prefix readline`" rbenv install 2.0.0-dev
class ApplicationController < ActionController::Base
# see also: http://stackoverflow.com/questions/2385799/how-to-redirect-to-a-404-in-rails
def not_found!
raise ActionController::RoutingError.new('Not Found')
end
end
@riywo
riywo / bashrc
Created December 12, 2012 23:49
setting hostname as screen window title
export PS1='\[\033k'"$HOSTNAME"'\033\\\]'"$PS1"
@sasimpson
sasimpson / gist:1112739
Created July 28, 2011 22:37
Ruby Net:HTTP chunked transfer
require 'uri'
require 'net/http'
class Chunked
def initialize(data, chunk_size)
@size = chunk_size
if data.respond_to? :read
@file = data
end
end