Skip to content

Instantly share code, notes, and snippets.

Kensuke Nagae kyanny

Block or report user

Report or block kyanny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tetsuok
tetsuok / complex_cube_root.go
Created Apr 2, 2012
An answer of the advanced exercise: complex cube roots on a tour of Go
View complex_cube_root.go
package main
import (
"fmt"
"math/cmplx"
)
// FIXME:
// Currently calculate only real part of the input
// complex number.
@fujimura
fujimura / README.md
Created May 11, 2012
heroku_config.rake
View README.md

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

$ rake heroku_config:upload

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

@zbskii
zbskii / gist:3699880
Created Sep 11, 2012
Ruby allocations
View gist:3699880
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 Sep 12, 2012
デモアプリ of Sapporo Ruby Kaigi Pre Event in Tokyo
View config.ru
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
View app.js
console.log('hi');
window.Todos = Ember.Application.create();
Todos.Todo = Ember.Object.extend({
title: null,
isDone: false
});
Todos.todosController = Ember.ArrayController.create({
content:[],
View gist:3888103
// 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に変更
View detect_invalid_enc.rb
#!/usr/bin/env ruby
while ARGF.readline
puts $.
begin
$_.match /./
rescue => e
puts $_
raise e
end
View gist:4001702
CONFIGURE_OPTS="--with-out-ext=tk,tk/* --with-opt-dir=`brew --prefix openssl`:`brew --prefix readline`" rbenv install 2.0.0-dev
View application_controller.rb
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 Dec 12, 2012
setting hostname as screen window title
View bashrc
export PS1='\[\033k'"$HOSTNAME"'\033\\\]'"$PS1"
You can’t perform that action at this time.