This file contains 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
BadResult = Class.new Exception | |
Int = Struct.new :i | |
Negate = Struct.new :e1 | |
Add = Struct.new :e1, :e2 | |
def eval e | |
case e | |
when Int then e | |
when Negate then case v1 = (eval e.e1) |
This file contains 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
set-option [-agoqsuw] [-t target-session | target-window] option value | |
buffer-limit number | |
escape-time time | |
exit-unattached [on | off] | |
quiet [on | off] | |
set-clipboard [on | off] | |
Available session options are: | |
assume-paste-time milliseconds | |
base-index index | |
bell-action [any | none | current] |
This file contains 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
#!/bin/sh | |
# When *.rkt files in the current directory are modified, this script runs | |
# their corresponding *test.rkt files and prints any errors or test fails. | |
inotifywait -qme close_write --format '%w%f' . | while read file; do | |
# only process *.rkt files - ignore all other files | |
test "${file%.rkt}" = "$file" && continue | |
# map the *.rkt file to its corresponding *test.rkt | |
# file, unless it already _is_ that *test.rkt file! |
This file contains 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
$ irb | |
## ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] | |
>> require './github_style_titles.rb' | |
true | |
>> gh = Redcarpet::Render::GithubStyleTitles.new | |
#<Redcarpet::Render::GithubStyleTitles:0x00000001cc3a48> | |
>> puts Redcarpet::Markdown.new(gh).render "test\n\n# test 1\n\n# test 2\n\n# test 1\n\n# test 1" | |
<a name="test-1" href="#test-1" class="anchor"><span class="anchor-icon"></span></a><h1 id="test-1">test 1</h1> |
This file contains 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 self.valid_time?(time) | |
(0 .. 2359).include? Integer(time) | |
rescue ArgumentError # invalid integer | |
false | |
end |
This file contains 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
#!/usr/bin/env ruby | |
# This script emulates [Spin] using [TestR]. | |
# | |
# Usage: testr-spin serve [-I<LOAD_PATH>]... <OVERHEAD_FILE>... | |
# Usage: testr-spin push <TEST_FILE> [<TEST_NAME>]... | |
# | |
# [Spin]: https://github.com/jstorimer/spin | |
# [TestR]: https://github.com/sunaku/testr | |
require 'json' |
This file contains 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 quoted_date(value) | |
base = value.respond_to?(:getutc) ? value.getutc.to_s(:db) : super | |
usec = sprintf(".%06d", value.usec) if value.respond_to?(:usec) | |
zone = " #{value.formatted_offset}" if value.respond_to?(:formatted_offset) | |
"#{base}#{usec}#{zone}" | |
end |
This file contains 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 'ember' | |
module ActionView | |
module TemplateHandlers | |
## | |
# @example Pass template processing options to Ember | |
# | |
# ActionView::TemplateHandlers::Ember.options = { | |
# :unindent => true, | |
# :shorthand => true, |
This file contains 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
! The Desert color scheme, ported to PuTTY from Vim by igvita: | |
! http://www.igvita.com/2008/04/14/custom-putty-color-themes/ | |
XTerm*vt100.foreground : rgb:ff/ff/ff | |
XTerm*vt100.background : rgb:33/33/33 | |
XTerm*vt100.cursorColor : rgb:00/ff/00 | |
XTerm*vt100.color0 : rgb:4d/4d/4d | |
XTerm*vt100.color1 : rgb:55/55/55 | |
XTerm*vt100.color2 : rgb:ff/2b/2b | |
XTerm*vt100.color3 : rgb:ff/55/55 | |
XTerm*vt100.color4 : rgb:98/fb/98 |
NewerOlder