Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
# adapted from http://stackoverflow.com/questions/4060212/in-linux-how-do-i-run-a-shell-script-when-a-file-or-directory-changes/20381373#20381373
DIRECTORY_TO_OBSERVE="src"
BUILD_SCRIPT=./gradlew
function block_for_change {
inotifywait -r \
-e modify,move,create,delete \
--exclude ".*/build/.*" \
@bamboo
bamboo / styles.less
Created November 13, 2014 09:55
My atom stylesheet (goes well with atom-soda-dark and monokai-soda)
.workspace {
font-size: 15pt;
text-rendering: optimizeLegibility;
}
.tree-view {
font-size: 14pt;
}
.editor {
@bamboo
bamboo / core.clj
Created June 12, 2015 15:17
system-composition in clojure
(ns composition.core
(:require [com.stuartsierra.dependency :as dep]))
#_(defprotocol Component ; an interesting thought
(dependencies [component])
(constructor [component configuration]))
(defn using [dependencies constructor]
{::dependencies dependencies
::constructor constructor})
@bamboo
bamboo / *>.lisp
Last active August 29, 2015 14:27
SFun Prelude.Applicative.*>
SFun Prelude.Applicative.*> [{e0},{e1},{e2},{e3},{e4},{e5}] 5
(SLet (Loc 6)
(SLet (Loc 6)
(SLet (Loc 6) SNothing
(SLet (Loc 7) SNothing
(SLet (Loc 8) SNothing
(SApp False Prelude.Applicative.<*> [Loc 6,Loc 7,Loc 8,Loc 3]))))
(SLet (Loc 7)
(SLet (Loc 7)
(SLet (Loc 7)
import Mono.Cecil
import Mono.Cecil.Cil
import System
import System.Collections
import Boo.Lang.PatternMatching
def CreateApiStub(fromAssembly as string, toAssembly as string):
module = ModuleDefinition.ReadModule(fromAssembly)
notImplementedExceptionCtor = module.Import(typeof(System.NotImplementedException).GetConstructor(array[of System.Type](0)))
import System.Linq.Enumerable
words = ("blueberry", "chimpanzee", "abacus", "banana", "apple", "cheese")
wordGroups = words.GroupBy({ w | w[0] })
for g in wordGroups:
print "Words that start with the letter $(g.Key):"
for word in g: print "\t$word"
@bamboo
bamboo / traceable_property.boo
Created October 28, 2010 17:08
macros are a beautiful thing
macro traceable_property:
case [| traceable_property $name as $type |]:
backingField = [|
private $("_$name") as $type
|]
yield backingField
yield [|
public $name:
@bamboo
bamboo / assign.boo
Created February 9, 2011 19:47
Meta method expanding named arguments into property assignments.
import System
import Boo.Lang.Compiler
import Boo.Lang.Compiler.Ast
import Boo.Lang.Compiler.Services
import Boo.Lang.Environments
import Boo.Lang.Compiler.MetaProgramming
[meta]
def assign(e as MethodInvocationExpression):
"""
package UnityEngine.Serialization {
class ActionScriptDeserializer {
public static function Deserialize(instance: IDeserializable, buffer: ByteArray, offset: int): int {
var reader = new SerializedStateReader(buffer, offset);
instance.Deserialize(reader);
return reader.offset;
}
}
@bamboo
bamboo / gist:980973
Created May 19, 2011 15:08
alchemy - struct instantiation
static AS3_Val Vector3f_DefaultValue() {
static AS3_Val (*DefaultValueShim)() = NULL;
if (DefaultValueShim == NULL) {
AS3_Val UnityEngine = AS3_String("UnityEngine");
AS3_Val Vector3_class = AS3_NSGetS(UnityEngine, "Vector3");
AS3_Val DefaultValue = AS3_GetS(Vector3_class, "DefaultValue");
DefaultValueShim = AS3_Shim(DefaultValue, null, "AS3ValType", false);
AS3_Release(DefaultValue);
AS3_Release(Vector3_class);
AS3_Release(UnityEngine);