This file contains hidden or 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 node_lookup(nodes): | |
tpl = "pub(crate) unsafe fn {}node_lookup<K: Key>(ptr: {}, key: &K) -> Result<Lookup, LookupError> {{" | |
"\n\n".join(["".join(tidy(group( | |
inline(opener), | |
"let raw = ptr.as_ptr_unchecked() as *mut u8;", | |
"prefetch_node(raw);", | |
"let tag = ptr.tag();", | |
debug("if tag != 0 { debug_assert!((&*raw.cast::<NodeHeader>()).tag == tag); }"), | |
group( | |
"match tag {", |
This file contains hidden or 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
# constants | |
panel-height: 75 # px | |
large-graph-width: 100 # px | |
small-graph-width: 25 # px | |
small-graph-height: 25 # px | |
sensor-refresh: 100 # milliseconds | |
sensor-refresh-slow: 1000 # milliseconds | |
graph-refresh: 500 # milliseconds | |
# sensor inputs |
This file contains hidden or 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
## Trait tables | |
An alternative idea I've been playing with recently takes inspiration | |
from game design, where ECS (entity component system) libraries are | |
the norm. | |
Objects normally can be thought of as a set of named fields. In an | |
ECS, an entity is just an id and it can have any number of | |
components. A component is the set of named fields traditionally like |
This file contains hidden or 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
module Main (main) where | |
import Prelude (Unit, ($), pure, unit) | |
import Data.Maybe (Maybe(..)) | |
import Data.Nullable (toMaybe) | |
import DOM.Simple (Element) | |
import DOM.Simple.Document (document) | |
import DOM.Simple.Console (log) | |
import Effect (Effect) | |
import FFI.Simple ((...), args2, delay) |
This file contains hidden or 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
#include <stdlib.h> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
int main (int argc, char *argv[]) { | |
vector<string> args; | |
for (int i = 0; i < argc; i++) { | |
args.push_back(string(argv[i])); |
This file contains hidden or 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
boot.user> (wtf? clojure.lang.PersistentVector) | |
(deftype++ clojure.lang.PersistentVector | |
:bases [c.l.APersistentVector c.l.IEditableCollection c.l.IKVReduce c.l.IObj c.l.IReduce] | |
;; methods | |
(^PersistentVector$Node .access$000 [self j.u.concurrent.atomic.AtomicReference int c.l.PersistentVector$Node]) | |
(^PersistentVector .adopt [self j.l.Object<>]) | |
(^Object<> .arrayFor [self int]) | |
(^ITransientCollection .asTransient [self]) | |
(^PersistentVector$TransientVector .asTransient [self]) | |
(^IPersistentVector .assocN [self int j.l.Object]) |
This file contains hidden or 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
(defn reexport [ns sym] | |
(cond (not (symbol? sym)) (throw (ex-info "reexport takes a symbol!" {})) | |
(not (namespace sym)) (throw (ex-info "reexport takes a namespaced symbol" {})) | |
:else | |
(let [v (resolve sym)] | |
(intern ns (-> sym name symbol (with-meta (meta v))) @v)))) |
This file contains hidden or 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
for x in *; do | |
if [ -d "$x" ]; then | |
pushd "$x" | |
if [ -d ".git" ]; then git pull; fi | |
popd | |
fi | |
done |
This file contains hidden or 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
Searching Dist::Zilla::Plugin::Git::NextRelease on cpanmetadb ... | |
-> FAIL Finding Dist::Zilla::Plugin::Git::NextRelease on cpanmetadb failed. | |
Searching Dist::Zilla::Plugin::Git::NextRelease () on metacpan ... | |
--> Working on Dist::Zilla::Plugin::Git::NextRelease | |
Fetching http://www.cpan.org/authors/id/K/KE/KENTNL/Dist-Zilla-Plugin-Git-NextRe | |
-> OK | |
-> FAIL Finding PPIx::Regexp on cpanmetadb failed. | |
Searching PPIx::Regexp (0.027) on metacpan ... |
This file contains hidden or 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
(ns my.namespace | |
(:require [util :refer [dev-prelude]])) | |
; in dev, import midje | |
; in live, strip out any code that uses midje | |
(dev-prelude) | |
(def always (constantly true)) | |
; tests! | |
(facts "always" | |
(always) => true)) |
NewerOlder