Or this?
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 "open-uri" | |
require "hpricot" | |
require "htmlentities" | |
require "json" | |
require "yaml" | |
Encoding.default_internal = Encoding.default_external = "UTF-8" | |
coder = HTMLEntities.new |
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
ard = Arduino.new | |
setup do | |
ard.setup do | |
name_analog 0, "lr" | |
name_analog 2, "ud" | |
end | |
end | |
def joy_x; ard.lr - width/2 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
module UI | |
class Canvas | |
def initialize x, y, w, h | |
@pointer = Native.ofxuicanvas_new x.to_f, y.to_f, w.to_f, h.to_f | |
end | |
def font file | |
Native.ofxuicanvas_setFont @pointer, File.expand_path(file).to_ptr, true, true, true, 0.0, 150 | |
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
class Signature | |
def self.[] *sig | |
Signature.new sig | |
end | |
def initialize sig | |
@signature = sig | |
end | |
def === other |
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
===== Thread 1 ===== | |
Total running time: 20.791475699000003s | |
index % time self children called name | |
---------------------------------------------------------- | |
[1] 99.8 0.00 20.75 1 Rubinius::Loader#script [1] | |
0.00 20.75 1 Rubinius::CodeLoader.load_script [2] | |
------------------------------------------------------- | |
0.00 20.75 1 Rubinius::Loader#script [1] | |
[2] 99.8 0.00 20.75 1 Rubinius::CodeLoader.load_script [2] | |
0.00 20.75 1 Rubinius::CodeLoader#load_script [3] |
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 'graphviz' | |
require 'graphviz/theory' | |
g = GraphViz.new( :G, :type => :digraph, :layout => 'dot' ) | |
binaries = {} | |
symbols = {} | |
nodes = {} | |
def list_symbols file, exported |
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
class ManyMessages < Dumbstore::App | |
text_id 'many' | |
def text params | |
10.times do | |
Dumbstore.twilio.sms.messages.create( | |
from:Dumbstore::NUMBER, | |
to:params['From'] | |
body:"I will say hello to you every 30 seconds" | |
) |
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
# encoding: utf-8 | |
require 'unicode_utils' | |
File.open('everyunicode.txt', 'w') do |file| | |
UnicodeUtils::Codepoint::RANGE.each do |i| | |
file.write("#{UnicodeUtils::Codepoint.new(i).to_s}\t") if UnicodeUtils.code_point_type(i) == :Graphic | |
end | |
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
// Parse string +path+ into nested objects within +object+ and assign | |
// the deepest key to +value+, without overwriting existing keys. | |
// Examples follow. | |
function parse(path, value, object) { } | |
parse("foo", 42, {}); // => { foo: 42 } | |
parse("foo.bar", 42, {}); // => { foo: { bar: 42 } } | |
parse("foo.bar.baz", 42, {}); // => { foo: { bar: { baz: 42 } } } | |
parse("foo", 42, { challenge: "accepted" }); // => { foo: 42, challenge: 'accepted' } | |
parse("foo.bar", 42, { challenge: "accepted" }); // => { foo: { bar: 42 }, challenge: 'accepted' } |