Skip to content

Instantly share code, notes, and snippets.

View sorah's full-sized avatar

Sorah Fukumori sorah

View GitHub Profile
@sorah
sorah / openLinkInBG.html
Created May 13, 2012 02:37
バックグラウンドでリンクを開くようにする
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>バックグラウンドでリンクを開くようにする</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('a').click(function (e) {
var clickEvent = document.createEvent('MouseEvents');
@sorah
sorah / 口からテンプレートがどんどん出てくる.rb
Created May 15, 2012 14:23
口からテンプレートがどんどん出てくる
# coding:utf-8
def render(template, variables = {})
template.gsub(/✖╹ *(.+?) *╹✖/) do
$1.split('.').inject(variables) do |hash, key|
hash[key.to_sym] or break nil
end
end
end
@sorah
sorah / foooo.rb
Created July 7, 2012 17:49 — forked from raa0121/foooo.rb
FooooScriptインタプリタっぽいもの
#/usr/bin/env ruby
# coding: utf-8
# ^ coding: is correct
def foooo
File.open(ARGV[0]){|f|
f.each do |line|
# Don't use "unless-else-end"
if /fo+/i =~ line
print "foooo"
else
fizz = f = lambda {
fizz = lambda {
fizz = lambda {
fizz = f
"Fizz"
}
nil
}
nil
}
@sorah
sorah / gist:7803201
Last active December 30, 2015 08:29 — forked from hsbt/gist:7719305
class A
def say
puts "A"
end
end
module B
def self.test
ref = refine(A) { }