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) |
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
(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 '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
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
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 '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
(comment | |
"an example of with-diret-linking for overloading symbols in a local scope" | |
) | |
(ns prova.core) | |
(use 'clojure.contrib.macro-utils) | |
(require '[prova.over :as over]) | |
(require '[clojure.contrib.macros :as macros]) |
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
_.mixin({ | |
select_if:function(data,options) { | |
if (options.cond()==true) { | |
return _(data).chain().filter(options.exec).value(); | |
} else { | |
return data; | |
} | |
} | |
}); |
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 'active_support' | |
require 'php' | |
require 'sourcify' | |
class Proc | |
def to_php | |
code=self.to_source.gsub("proc {","")[0..-2] | |
PHP.generate(code).to_php.gsub("<?php","") |
OlderNewer