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
(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
(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
(:: 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
(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
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
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
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","") |
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
(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]) |