Skip to content

Instantly share code, notes, and snippets.

View noxecane's full-sized avatar
:shipit:
let's find out

Kunle Arewa noxecane

:shipit:
let's find out
View GitHub Profile
@noxecane
noxecane / router.es6
Last active January 25, 2016 21:10 — forked from jbroadway/app.js
Simple History.js-based client-side router
'use strict';
import {Event} from './event.es6';
import * as func from './func.es6';
import * as classes from './classes.es6';
const paramReg = /:(\w+)/g;
const slashReg = /\//g;
const paramRepl = '(.*?)';
const slashRepl = '\\/';
@noxecane
noxecane / keypath.es6
Last active November 28, 2015 23:17 — forked from anonymous/index.html
Data binding implementation in es6
export class KeyPath {
static lastValue(keypath, object) {
return keypath.split('.').reduce((prev, curr) => {
return prev && prev[curr];
}, data);
}
static lastKey(keypath, object) {
return keypath.split('.').pop();
}
@noxecane
noxecane / funk.es6
Created January 25, 2016 21:06
Some functions I use daily for functional programming.(most of them from Javascript Allonge)
'use strict';
export const isNothing = x => x === null || x === undefined;
// iterations
export const repeat = (num, fn) => (num > 0) ?
(repeat(num - 1, fn), fn(num - 1)) :
(void 0);
// Decorators
@noxecane
noxecane / events.clj
Last active January 17, 2017 04:54
Using core.async for pub-sub in where the subscriber defines what he wants
(ns tools.events
(:require [clojure.core.async :as a]))
(defn new-emitter
"Creates a map to hold configuration of an emitter"
([]
(new-emitter 10))
([buff]
(let [in (a/chan 10)
@noxecane
noxecane / combine.js
Last active October 7, 2017 20:40
Code I can't do without on JS
var argsToArr = function (args) {
return Array.prototype.slice.call(args, 0);
};
var argFn = function (fn) {
return function () {
return fn(argsToArr(arguments));
};
};
@noxecane
noxecane / term
Created August 31, 2018 18:38
Get haskell-src-exts to fail
```bash
$ mv a.js b.js
```

I was trying to build haddock using stack so I can generate docs for hoogle.

$ stack haddock --haddock-deps

# fails with

2018-05-23 09:50:28.287257: [debug] Run process within /tmp/stack32381/haskell-src-exts-1.20.2/: /home/tester/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source
@(src/Stack/Build/Execute.hs:1133:29)
Progress 1/2
@noxecane
noxecane / OpaleyeExt.hs
Last active June 9, 2019 21:30
Simplify your life with Opaleye
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
module OpaleyeExt
( MonadDB(..)
, ConstraintError(..)
, safeInsertOne
, safeInsertOneReturningId
, safeInsertOneReturningId'
, select_
@noxecane
noxecane / app.conf
Created June 24, 2019 21:08
Proxy to a service
server {
listen [::]:443 ssl http2; # and this
listen 443 ssl http2; # change this
# The host name to respond to
server_name localhost;
location /api/v1/account/ {
proxy_pass http://localhost:3008;
proxy_set_header Host $http_host;
@noxecane
noxecane / settings
Created September 2, 2019 14:38
VS Code Settings
Sometingh