Skip to content

Instantly share code, notes, and snippets.

Avatar

Sorah Fukumori sorah

View GitHub Profile
View refinements.rb
class A
def say
puts "A"
end
end
module B
def self.test
ref = refine(A) { }
View gist:7803201
View fizzbuzz.rb
fizz = f = lambda {
fizz = lambda {
fizz = lambda {
fizz = f
"Fizz"
}
nil
}
nil
}
@sorah
sorah / foooo.rb
Created Jul 7, 2012 — forked from raa0121/foooo.rb
FooooScriptインタプリタっぽいもの
View foooo.rb
#/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
@sorah
sorah / 口からテンプレートがどんどん出てくる.rb
Created May 15, 2012
口からテンプレートがどんどん出てくる
View 口からテンプレートがどんどん出てくる.rb
# 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 / openLinkInBG.html
Created May 13, 2012
バックグラウンドでリンクを開くようにする
View openLinkInBG.html
<!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');
View srv2.rb
#encoding: utf-8
require 'nokogiri'
require 'net/irc'
BOTNICK = "Glass_bot"
class TCEBot < Net::IRC::Client
def initialize(*args)
super
View gist:719566
#encoding: utf-8
require 'nokogiri'
require 'net/irc'
BOTNICK = "Glass_bot"
class TCEBot < Net::IRC::Client
def initialize(*args)
super
View gist:573131
100.times{|i|s=(i%3==0?"Fizz":'')+(i%5==0?"Buzz":'');puts s==""?i:s}
You can’t perform that action at this time.