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
# 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
# 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
(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
if(navigator.userAgent.match(/android/i)) { | |
(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 | |
gem 'escape_utils', '0.2.3' | |
require 'rack' | |
require 'escape_utils' | |
require 'minitest/unit' | |
MiniTest::Unit.autorun | |
class EscapeTest023 < MiniTest::Unit::TestCase | |
def test_rack_escape_and_unescape |
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 'open-uri' | |
if ARGV.empty? and $stdin.stat.zero? | |
$stdout.print(<<-EOL) | |
usage: | |
ruby #{__FILE__} url_include.text | |
ruby #{__FILE__} http://hato.2ch.net/akb/dat/1320063456.dat | |
ruby #{__FILE__} < url_include.text | |
EOL |
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
year_range=$(seq 2001 2011) | |
month_range=$(seq 01 12) | |
day_range=$(seq 1 31) | |
for y in $year_range; do | |
mkdir -p $y | |
for m in $month_range; do | |
month=`printf '%02d' $m` | |
mkdir -p "$y/$month" | |
for d in $day_range; do |
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 -*- | |
module Ext | |
module ActiveRecord | |
module QueryBuilderExtension | |
def self.included(klass) | |
klass.extend ClassMethods | |
end | |
module ClassMethods | |
def build_left_join_query(*joins) |
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
<html> | |
<head> | |
<title>test dropdown</title> | |
<style type="text/css"> | |
h1 { | |
padding: 5px 10px; | |
background: #efefef; | |
} | |
.click_area { | |
border: 1px solid #ccc; |