Skip to content

Instantly share code, notes, and snippets.

class Dynamical
define_method :works_fine do |&block|
5.times { |n| block.call(n) }
end
def self.defn name
define_method name do |&block|
5.times { |n| yield n }
end
end
module Rack
class GoogleAnalytics
TRACKING_CODE = <<-EOCODE
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("{{ID}}");
#!/bin/sh
# Author: Carl Youngblood, 2010
# Based on http://www.novell.com/coolsolutions/feature/15380.html
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# http://gist.github.com/636681
# http://tinyurl.com/learn-ruby-processing
require 'rinda/ring'
DRb.start_service
ring_server = Rinda::RingFinger.primary
o = ring_server.read([:name,:processing,nil,nil])[2]
o.stroke 255, 0, 0 #Red outline
#start this first
require 'rinda/ring'
require 'rinda/tuplespace'
DRb.start_service
# Create a TupleSpace to hold named services, and start running
Rinda::RingServer.new Rinda::TupleSpace.new
# Wait until the user explicitly kills the server.

Stuff in Ruby that is/isn't supported, or is different

Block Comments

###=begin / =end

Rib Rdb writes: "The new parser doesn't support this". Use single line comments instead.

/* --- */ format is also supported.

/*
with selected true as a param.
Element.select.
option("1", "one").
option("2", "two", true).
option("3", "three").to_s
produces:
require 'rubygems'
require 'kingdom-assignment'
if CSV.const_defined? :Reader
# require 'fastercsv'
INSTALLED_CSV = FasterCSV
else
INSTALLED_CSV = CSV
end
6: Cannot find instance method set(int, int) on java.util.List
Mirah::InternalCompilerError: Cannot find instance method set(int, int) on java.util.List
infer at ~/hacking/fresh_mirah/lib/mirah/typer/simple.rb:280
infer at ~/hacking/fresh_mirah/lib/mirah/ast/structure.rb:34
each at org/jruby/RubyArray.java:1603
infer at ~/hacking/fresh_mirah/lib/mirah/ast/structure.rb:33
infer at ~/hacking/fresh_mirah/lib/mirah/typer/simple.rb:275
infer at ~/hacking/fresh_mirah/lib/mirah/ast/flow.rb:125
collect at org/jruby/RubyArray.java:2336
@baroquebobcat
baroquebobcat / output.txt
Created October 30, 2011 19:43 — forked from igrigorik/output.txt
test.mirah
~/hacking/fresh_mirah]$ bundle exec mirahc -V test.mirah
Parsing...
test.mirah
Inferring types...
* [Mirah::Typer] New type defined: 'Test' < ''
* [Mirah::Typer] Learned local type under #<Mirah::AST::StaticScope:0x39e2ee3f> : test = Type(boolean)
* [AST] [RequiredArgument] RequiredArgument(test) resolved!
...