This file contains hidden or 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
(function($) { | |
var dataKey = "phText"; | |
var placeholderColor = "#aaa"; | |
$("[placeholder]").each(function() { | |
var $elem = $(this); | |
var originalText = $elem.attr("placeholder"); | |
var originalColor = $elem.css("color"); | |
$.data(this, dataKey, originalText); |
This file contains hidden or 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
# coding: utf-8 | |
class Brainfuck | |
class Memory | |
def initialize(opts = {}) | |
@memory = Hash.new{|h,k| h[k] = 0 } | |
@pointer = 0 | |
@out = opts[:out] || $stdout | |
@in = opts[:in] || $stdin | |
end |
This file contains hidden or 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
# coding: utf-8 | |
class Memory | |
def initialize(opts = {}) | |
@memory = Hash.new{|h,k| h[k] = 0 } | |
@pointer = 0 | |
@out = opts[:out] || $stdout | |
@in = opts[:in] || $stdin | |
end |
This file contains hidden or 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 'ripper' | |
require 'cgi' | |
require 'digest/sha1' | |
class Ruby2HTML < Ripper::Filter | |
def on_default(event, tok, f) | |
f << CGI.escapeHTML(tok) | |
end | |
private |
This file contains hidden or 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 'ripper' | |
require 'cgi' | |
class Ruby2HTML < Ripper::Filter | |
def on_default(event, tok, f) | |
f << CGI.escapeHTML(tok) | |
end | |
private | |
def respond_to?(name, priv = false) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# | |
# support_#{feature}? などというメソッドで、 | |
# 機能をサポートしているかどうかを返せるようにするためのモジュール | |
# | |
# インクルードしたクラスで | |
# | |
# feature :foo, :baa | |
# feature :hoge, :support => false | |
# feature :fuga, :support => true |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
require 'rack' | |
require 'action_controller/request' | |
require 'action_controller/response' | |
require 'action_controller/test_process' | |
module RequestSpecHelper | |
def self.included(closure) | |
closure.send :include, Helpers | |
end |
This file contains hidden or 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 'nokogiri' | |
gem 'rack' | |
gem 'thin' |
This file contains hidden or 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
function fibs(n) { | |
var generator = (function(){ | |
var beforeNum = 0; | |
var nextNum = 1; | |
var resultNum; | |
var f = function() { | |
resultNum = beforeNum; | |
beforeNum = nextNum; | |
nextNum = resultNum + nextNum; | |
return resultNum; |
This file contains hidden or 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
def fibs(n) | |
results = [] | |
a, b = 0, 1 | |
n.times do | |
results << a | |
a, b = b, a + b | |
end | |
results | |
end |