Skip to content

Instantly share code, notes, and snippets.

View rrichardson's full-sized avatar
💭
⚔️ Hacking Away

Rick Richardson rrichardson

💭
⚔️ Hacking Away
View GitHub Profile
var flatiron = require('flatiron'),
ecstatic = require('ecstatic'),
socketful = require('socketful'),
restful = require('restful'),
models = require('./models').fixtures;
var app = module.exports = flatiron.app;
app.use(flatiron.plugins.http, {
before: [
diff --git a/lib/pkgcloud/core/compute/bootstrapper.js b/lib/pkgcloud/core/compute/bootstrapper.js
index 819ea80..9b2ffdf 100644
--- a/lib/pkgcloud/core/compute/bootstrapper.js
+++ b/lib/pkgcloud/core/compute/bootstrapper.js
@@ -171,7 +171,9 @@ Bootstrapper.prototype.createServer = function (options) {
if (options.flavorId) {
createOptions.flavor = options.flavorId;
}
-
+ if (options.keyname) {
import Graphics.Input as Input
import Http
import WebSocket
import JavaScript.Experimental as JS
import Json
import Window
import Keyboard
(nameInput, username) = Input.field "Your name here"
module Expressions where
import Text.ParserCombinators.Parsec
import Control.Monad
import Control.Monad.Error
import System.IO
data Term a = IntVal Integer
| StrVal String
| RealVal Double
combine' :: (a -> a -> a) -> Value -> Value -> Value
combine' fun (IntVal a) (IntVal b) = IntVal $ fun a b
combine' fun (IntVal a) (RealVal b) = RealVal $ fun b $ fromInteger a
combine' fun (RealVal a) (IntVal b) = RealVal $ fun a $ fromInteger b
combine' fun (RealVal a) (RealVal b) = RealVal $ fun a b
--combine' fun (StrVal a) (StrVal b) = StrVal $ fun a b
webbitchat.core=> (defmulti send-multi (fn [msg] (-> msg :action keyword)))
nil
webbitchat.core=> send-multi
#<MultiFn clojure.lang.MultiFn@4706c7b2>
webbitchat.core=> (defmethod send-multi :SAY [msg] (println "I just called to say: " (:message msg)))
#<MultiFn clojure.lang.MultiFn@4706c7b2>
webbitchat.core=> (defmethod send-multi :YELL [msg] (println "I JUST CALLED TO YELL: " (clojure.string/upper-case (:message msg))))
#<MultiFn clojure.lang.MultiFn@4706c7b2>
webbitchat.core=> (send-multi {:message "I love you" :action "SAY"})
@rrichardson
rrichardson / gist:8515407
Last active January 3, 2016 20:29
A slight shortcut for importing hierarchical data into datomic
(def org1
[:db/id (tmp)
:organization/name "Org 1"
:organization/league
[:db/id (tmp)
:league/name "ligue 1"
:league/field
[:db/id (tmp)
:field/name "The field of dreams"
:field/address "123 4th avenue, France"]
typedef struct HCountedArray_ {
size_t capacity;
size_t used;
HArena * arena;
struct HParsedToken_ **elements;
} HCountedArray;
typedef struct HBytes_ {
const uint8_t *token;
size_t len;
enum HParserBackend {
PB_MIN = 0,
PB_PACKRAT = PB_MIN, // PB_MIN is always the default.
PB_REGULAR,
PB_LLk,
PB_LALR,
PB_GLR,
PB_MAX = PB_GLR
}
@rrichardson
rrichardson / gist:4e63b4b4189f2c486bdf
Last active August 29, 2015 14:04
recursion in rust.. looks like hieroglyphics
use std::fmt::Show;
trait Mappable<T> {
fn each<'r>(&self, f: &mut |&T|: 'r -> ());
fn map<'r, B>(&self, f: &mut |&T|: 'r -> B) -> Vec<B>;
}
enum BinaryTree<T> {
Leaf(T),