Skip to content

Instantly share code, notes, and snippets.

View robjens's full-sized avatar

Rob J robjens

  • Netherlands
View GitHub Profile
@robjens
robjens / countdown_jquery.js
Last active January 3, 2016 15:01
Several Dutch (JavaScript) locale support files
/* http://keith-wood.name/countdown.html
Dutch initialisation for the jQuery countdown extension
Written by Mathias Bynens <http://mathiasbynens.be/> Mar 2008.
This is NOT for countdownjs
*/
(function($) {
$.countdown.regional['nl'] = {
labels: ['Jaren', 'Maanden', 'Weken', 'Dagen', 'Uren', 'Minuten', 'Seconden'],
labels1: ['Jaar', 'Maand', 'Week', 'Dag', 'Uur', 'Minuut', 'Seconde'],
compactLabels: ['j', 'm', 'w', 'd'],
@robjens
robjens / rfc-3986-uri-syntax.abnf
Last active January 1, 2016 20:59
RFC ABNF's
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
URI-reference = URI / relative-ref
absolute-URI = scheme ":" hier-part [ "?" query ]
@robjens
robjens / bootstrap.sh
Created December 20, 2015 20:28
Small helper to quickly create a working cljs project from scratch
#!/usr/bin/env bash %
#
# bootstrap.sh
#
# Copyright (C) 2015 Rob Jentzema <rob.jentzema@gmail.com>
#
# Distributed under terms of the MIT license.
#
# Reference(s):
# 1. https://github.com/clojure/clojurescript/wiki/Quick-Start
@robjens
robjens / foo.js
Created December 10, 2015 21:10
ES6 tagged template strings, this helped me grok it a bit better
var a = 5;
var b = 10;
var c = 2;
function tag(strings, ...values) {
console.log(strings[0].replace('\n', '')); // "Hello "
console.log(strings[1].replace('\n', '')); // " world "
console.log(values[0]); // 15
console.log(values[1]); // 50
@robjens
robjens / elk.zsh
Created December 7, 2015 23:02
A little ELK zsh script to make working repetive tasks a bit easier
#!/usr/bin/env zsh
emulate -L zsh || return 1
# Top level variables
eshost="http://support.internal.sevenmatches.com"
esport=9200 beat=(top packet file) beats=(${^beat}beat)
#
# Task handler
@robjens
robjens / plugins_Clojure_codemirror_clojure-mode.js
Created December 2, 2015 00:42
Clojure codemirror syntax file. Need to be tweaked to show meta-data properly.
CodeMirror.defineMode("clojure", function () {
var BUILTIN = "builtin", COMMENT = "comment", COMMENTFORM = "comment comment-form"; STRING = "string", CHAR = "char",
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword", META = "meta";
var INDENT_WORD_SKIP = 2;
function makeKeywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
@robjens
robjens / one.clj
Last active November 23, 2015 13:15
NPM todays updates
(def npm (slurp "https://registry.npmjs.org/-/all/static/today.json"))
(distill* '[cheshire "LATEST"] {:verbose false})
(require '[cheshire.core :as json])
(require '[clojure.walk :refer [keywordize-keys]]
'[clojure.core.reducers :as r])
@robjens
robjens / a.asciidoc
Last active November 22, 2015 20:56
Wisp gotchas

Wisp for Node.js

Some stuff that took me longer than it should to grok, figure out, look-up or otherwise non-intuitive or radically different from Clojure.

Functions

namespace

Operates on symbols and keywords but has a implementation which is picky. Takes keywords and symbols as follows: (namespace 'foo/bar), (namespace (keyword "foo" "bar")) or, (namespace (keyword :foo :bar)) all return foo

@robjens
robjens / a.asciidoc
Last active November 22, 2015 19:27
Logic, math, linguistics, computing

In computing, the least significant bit (LSB) is the bit position in a binary integer giving the units value, that is, determining whether the number is even or odd. The LSB is sometimes referred to as the right-most bit, due to the convention in positional notation of writing less significant digits further to the right. It is analogous to the least significant digit of a decimal integer, which is the digit in the ones (right-most) position.

It is common to assign each bit a position number, ranging from zero to N-1, where N is the number of bits in the binary representation used. Normally, this is simply the exponent for the corresponding bit weight in base-2 (such as in 231..20). Although a few CPU manufacturers assign bit numbers the opposite way (which is not the same as different endianness), the term least significant bit itself remains unambiguous as an alias for the unit bit.

By extension, the least significant bits (plural) are the bits of the number closest to, and including, the LSB.

The least

@robjens
robjens / gist:5e0f3527de2398d4e12f
Last active November 18, 2015 13:18
MongoDb standalone initialization script
var hosts = [
'hostname.mongo.server'
];
for( var hosti in hosts ){
var hostname = hosts[hosti];
print(hostname);
var dbo = new Mongo(hostname + ":27017").getDB('test');