Skip to content

Instantly share code, notes, and snippets.

type _ trepr =
| Int : int trepr
| Bool : bool trepr
| List : 'a trepr -> 'a list trepr
let bool_to_string = function
| true -> "True"
| false -> "False"
let int_to_string = Printf.sprintf "%d"
trap "kill 0" SIGINT SIGTERM EXIT
make watch_assets &
make run
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Mono.TextEditor.Highlighting.ResourceXmlProvider.Open'.
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /private/tmp/source/bockbuild-crypto-mono/profiles/mono-mac-xamarin/build-root/mono-3.0.10/mcs/class/corlib/System.Reflection/MonoMethod.cs:552
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00013] in /private/tmp/source/bockbuild-crypto-mono/profiles/mono-mac-xamarin/build-root/mono-3.0.10/mcs/class/corlib/System.Reflection/MonoMethod.cs:558
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x000af] in /private/tmp/source/b
module LikeRoutes
def self.registered(app)
url_for_like = app.url(app.record_name,
"#{app.base_url}/:id/like")
app.get url_for_like do
# ...
end
end
end
class Cuba
module Render
def render(template, locals = {}, options = {}, &block)
_cache.fetch(template) {
Tilt.new(template, 1, options.merge(outvar: '@_output')
}.render(self, locals, &block)
end
end
end
class MyRender << Fiasco::Render
def render(name, locals = {})
if ENV['RACK_ENV'] == 'development' && @templates[name]
@compiled.delete(name)
declare(name, @templates[name].filename)
end
super(name, locals)
end
end
(import (chibi io) (chibi process))
(define (for-each-line proc port)
(let loop ((line (read-line port)))
(cond ((not (eof-object? line))
(proc line)
(loop (read-line port))))))
(call-with-process-io '("ls" "/tmp")
(lambda (pid in out err)
@tizoc
tizoc / pipeline-tests.scm
Created May 2, 2012 03:43
clojure's -> and ->> for chibi scheme
(import (scheme) (clojure pipeline) (chibi test))
(test
"(-> 3.0 (- 2) (* 5) sqrt)"
(sqrt (* (- 3.0 2) 5))
(-> 3.0 (- 2) (* 5) sqrt))
(test
"(->> 3.0 (- 5) (* 5) sqrt)"
(sqrt (* 5 (- 5 3.0)))
function mkgemsenv -d "Creates a gemset env in the current directory"
mkdir -p ".gemsenv/ENV"
echo (pwd)"/.gemsenv" > ".gemsenv/ENV/GEM_HOME"
echo (pwd)"/.gemsenv:"(gem env path) > ".gemsenv/ENV/GEM_PATH"
echo (pwd)"/.gemsenv/bin:"(sh -c 'echo $PATH') > ".gemsenv/ENV/PATH"
end
function usegemsenv -d "Starts a new shell using the gemset env in the current directory"
envdir .gemsenv/ENV $SHELL
end
(datatype option-type
______________
@nothing : (option A);
X : Type;
______________
(@just X) : (option Type);
_____________
(just? X) : verified >> X : (option A);)