Skip to content

Instantly share code, notes, and snippets.

View fasterthanlime's full-sized avatar
🌌
4 oreos from heaven

Amos Wenger fasterthanlime

🌌
4 oreos from heaven
View GitHub Profile
/**
* With template, everything is inlined - the struct
* type is written inline, the methods become macros,
* so there should be no symbol conflict
*/
MyArray: cover template <T> {
length: Int
data: T*
(ns conchtest.core
(:require [me.raynes.conch.low-level :as sh] ;; https://github.com/Raynes/conch
[clojure.java.io :as io])) ;; clojurified Java classes
(defn lines
[]
;; ->> is a 'threading operator' - it allows us to write
;; call pipelines in a more natural order.
;; See doc at: http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E
(->>
#!/usr/bin/ruby
require 'net/http'
require 'cgi'
require 'uri'
def wifi_info
uri = URI("http://192.168.1.1/Info.live.htm")
body = Net::HTTP.get(uri)
@fasterthanlime
fasterthanlime / stack.js
Created November 4, 2014 17:18
Ki source map / stack trace problem.
_ki = {
init: function (self$1813, ns_name$1814) {
if (_ki.namespaces[ns_name$1814] === undefined) {
_ki.namespaces[ns_name$1814] = { vars: {} };
}
self$1813._ki_ns_name = ns_name$1814;
self$1813._ki_ns_ctx = self$1813;
_ki.intern.bind(self$1813)(_ki.modules.core);
_ki.intern.bind(self$1813)(_ki.modules.mori);
_ki.intern.bind(self$1813)(_ki.modules);
macro sweet {
rule { _throw $x } => { throw $x; }
}
function problem () { sweet _throw "Hello" }
problem();
// 10 empty lines to highlight the problem.
//
//
//
//
//
//
//
//
// ... there we go.
@fasterthanlime
fasterthanlime / index.js
Created November 13, 2014 22:29
requirebin sketch
var I = require("ancient-oak");
var a = I({a: ["Yes.", "Quite."], b: "Naturally!"});
console.log("a == a ?", a === a);
var b = a.set("b", "Of course!")
console.log("a == b ?", a === b);
console.log("a('a')", a('a').dump())
console.log("b('a')", b('a').dump());
console.log("a('a') === b('a')", a('a') === b('a'));
@fasterthanlime
fasterthanlime / immutables-structs-js.md
Last active August 29, 2015 14:09
Immutable data structures in JavaScript
 | Lang      | Size    | Min. | Structures | Keys | License    | Author 

-----|---------------|---------|----------|------------|-----------|------------|------------------ mori | Cljs | 735K | 201K | all of cljs | any | EPL | David Nolen / clj team
immutable | JS | 116K | 53K | most of cljs | any | BSD | Lee Byron ancient-oak | JS | 15K | 6.5K | arrays, objects | strings, ints | MIT | Szymon Witamborski hamt | Khepri | 13K | 7.5K | just hamt | strings, any | MIT | Matt Bierner

Notes:

@fasterthanlime
fasterthanlime / ast.json
Created November 18, 2014 10:39
Mozilla Parser API is a lot more verbose than XML
{
"type": "Program",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
@fasterthanlime
fasterthanlime / sample.cljs
Created November 25, 2014 12:41
Oh cljs...
(ns wtf_require.client)
(defprotocol IShout
(-shout [this]))
(deftype Dog
IShout
(-shout [this]
(prn "Dog shout, Arity 1")))