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 'rubygems' | |
require 'v8' | |
require 'johnson' | |
require 'ruby_parser' | |
sexp=Johnson::Parser.parse %{ | |
var sum=function sum (x,y) { | |
return x+y | |
}; |
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
run_in_context: (fn,context) -> | |
if fn.length>0 | |
fn.apply null,[context] | |
else | |
fn.apply context | |
process: (n,fn) -> | |
run_in_context fn,n | |
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 'rubygems' | |
require 'yaml' | |
class Player | |
attr_accessor :name,:surname | |
def initialize(opt={}) | |
@name=opt[:name] | |
@surname=opt[:surname] |
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 'rubygems' | |
require 'liquid' | |
tpl=%{ | |
{%for player in players%} | |
{{player.name}} | |
{{player.surname}} | |
{%endfor%} |
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
(eval Ruby2Ruby.new.process("Proc.new {|z| z+1}".to_sexp)).call 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 'Tempfile' | |
class Test | |
def `(s) | |
output="" |
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 'rubygems' | |
require 'xmlrpc/client' | |
# an example of client for drupal made with xmlrpc | |
class Drupal | |
def initialize(opt={},&blk) | |
@client = XMLRPC::Client.new( opt[:host] , "/?q=services/xmlrpc") | |
@[email protected]("system.connect", 1) |
NewerOlder