Skip to content

Instantly share code, notes, and snippets.

View matths's full-sized avatar
💻
In a former live I was a flash developer.

Matthias Dittgen matths

💻
In a former live I was a flash developer.
View GitHub Profile
@matths
matths / index.js
Last active January 27, 2016 21:48
composition with lodash _.flow(), and with flowArg to differently distribute arguments
var _ = require('lodash'); // 4.0.1
// filter implementations doesn't matter right now
var _method = function (method, handler) {
return function (req, res, next) {
console.log('_method middleware', method);
handler(req, res, next);
// or call next()
}
@matths
matths / Binding.js
Created November 24, 2018 15:00
simple two way binding with vanilla js as explained by Blaize Stewart (@theonemule) at https://www.wintellect.com/data-binding-pure-javascript/
// inspired by @theonemule (Blaize Stewart) via https://www.wintellect.com/data-binding-pure-javascript/
window.Binding = (function () {
var bindingStore = {};
function Binding(prop, obj) {
if (!obj) {
obj = bindingStore;
bindingStore[prop] = undefined;
}
@matths
matths / example_with_middleware.js
Created February 6, 2019 22:21
basic reverse proxy middleware in comparison to the node-http-proxy module
var http = require('http');
var createProxyMiddleware = require('./proxy_middleware');
/*
/etc/hosts
127.0.0.1 hostA
127.0.0.1 hostB
*/
@matths
matths / as-object.js
Last active February 9, 2019 18:53
"You can also use the approach below, which will result in a very nice data table at the top of your markdown when viewing the file GitHub:"
{
Title: 'My awesome markdown file',
Author: 'Me',
Scripts: [
'js/doStuff.js',
'js/doMoreStuff.js'
]
}
@matths
matths / install_sqlcipher.sh
Last active December 31, 2019 13:46
Install better-sqlite3 node package with custom sqlcipher amalgamation
#!/bin/bash
# build the SQLCipher .c/.h files
git clone https://github.com/sqlcipher/sqlcipher.git
cd sqlcipher
./configure --enable-tempstore=yes --enable-fts5 CFLAGS="-DSQLITE_HAS_CODEC"
make sqlite3.c
# prepend better-sqlite3 configuration
# https://github.com/JoshuaWise/better-sqlite3/blob/v5.0.1/docs/compilation.md