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 PhpNode extends SpecialForm{ | |
public $body_index = 2; | |
public function compile_statement(){ | |
$body = $this->compile_body(); | |
eval("\$body=$body"); | |
echo $body; | |
return $this->format_line($body); |
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
rainbows -c rainbows.conf |
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 "Slim/Slim.php") | |
(:: Slim (init)) | |
(fn hello (name) (echo (. "Hello, " name)) "") | |
(:: Slim (get "/hello/:name" "hello")) | |
(:: Slim (run)) |
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
(:: ORM (configure "mysql:host=localhost;dbname=my_database")) | |
(:: ORM (configure #username #database_user)) | |
(:: ORM (configure #password #top_secret )) | |
(def people | |
(-> (:: ORM (for_table #person)) | |
(where #name "Fred") | |
(where_raw "(`age` = ? OR `age` = ?)" [20,25]) | |
(order_by_asc #name) |
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
(fn transiction (callback) | |
(-> (:: ORM get_db) (beginTransaction)) | |
($callback ORM) | |
(-> (:: ORM get_db) (commit)) | |
) | |
(transition (lambda (orm) (print_r orm))) |
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 result | |
(-> (db_select #users #u) | |
(condition "u.uid" 0 "<>") | |
(fields #u [#uid #name #created #access]) | |
(range 0 100) | |
(execute))) |
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
checkDeferred=(df,fn) -> | |
callback = jasmine.createSpy() | |
df.then(callback) | |
waitsFor -> callback.callCount > 0 | |
runs -> | |
#expect(callback).toHaveBeenCalled() | |
fn.apply @,callback.mostRecentCall.args if fn | |
checkJson = (path,fn) -> |
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
describe "async", -> | |
it "async not null", -> | |
expect(async).not.toBeNull() | |
it "respond to map", -> | |
expect(async.map).not.toBeNull() | |
it "[1,2,3] map (x) -> x + 1 eq [2,3,4]", -> | |
callback = jasmine.createSpy() | |
summer= (el,callback) -> callback null, el + 1 | |
async.map([1,2,3],summer,callback) | |
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
Object::attr_accessor= (prop) -> | |
self=@ | |
self["_#{prop}"]=null | |
self[prop]=(value) -> | |
@["_#{prop}"]=value if value? | |
@["_#{prop}"] | |
Player={} |
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
#this version don't work with prototype chain for generation variable prop_value with closure | |
Object::attr_accessor= (prop) -> | |
self=@ | |
do -> | |
prop_value=null | |
self[prop]=(value) -> | |
prop_value=value if value? | |
prop_value |