Skip to content

Instantly share code, notes, and snippets.

View mientjan's full-sized avatar
🌴
On vacation

Mient-jan Stelling mientjan

🌴
On vacation
View GitHub Profile
@mientjan
mientjan / tsconfig.json
Created February 23, 2017 21:38
Blue & Typescript
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es6",
"module": "commonjs",
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": false,
@mientjan
mientjan / gist:d9d92242bceb2a2029891d5cedd04903
Created January 4, 2017 01:17
Quick Fix script make all paths relative to each other
var glob = require('glob');
var path = require('path');
var fs = require('fs');
var base = './deploy/htdocs/version/src/inc/script/app/';
var root = path.normalize(base + '../');
glob(root + '/**/*.ts', {}, (err, files) => {
console.log(files)
files.forEach(value => {
var people = ['(quintie)', '(miepmiep)'];
var people = ['(sanderk)', '(miepmiep)'];
`
########################
# ## ## ## ## #
# # ### ## #### ###
# #### ## #### ###
# #### ## #### ###
# # ### ## #### ###
# ## ### ##### ###
@mientjan
mientjan / gist:909e0b5a1fac4188be54c2a0717cedde
Created July 15, 2016 18:16
regex import require to import from
import\s(\w+)\s=\srequire\(\'([\w.\s\/]+)\'\)\;
import $1 from '$2';
@mientjan
mientjan / modulo
Last active January 26, 2016 12:22
function mod(a, b){
return a - b * Math.floor(a/b)
}
var v = '00:05:19 00:08:13 00:09:19 00:10:23 00:12:02 00:13:06 00:13:19 00:14:11 00:15:10 00:16:17 00:18:03 00:20:06 00:21:09 00:22:03 00:23:09 00:23:20 00:24:19 00:26:03 00:27:19 00:28:15 00:29:23 00:30:21 00:31:21 00:34:07 00:36:11 00:37:18 00:39:12 00:40:19 00:42:12 00:45:22 00:46:19';
var events = {}
var prev = 0;
var curr = 0;
v.split(' ').forEach((value, index) => {
curr = timeToFloat(value)
if(index>0){
events['moment_' + index] = [prev, curr]
}
// A bitwise FlagMachine
// create a enum
enum PizzaIngredients {
BREAD = 1 << 0,
CHEESE = 1 << 1,
TOMATO = 1 << 2,
UNIONS = 1 << 3,
GARLIC = 1 << 4,
}
javascript:(function(k)%7Bvar m,d,c,n%3Ddocument.body,h%3D"",a%3Dnavigator.userAgent,g%3D3%3Bswitch(true)%7Bcase a.indexOf("WebKit")!%3D-1:h%3D"webkit"%3Bbreak%3Bcase a.indexOf("Firefox")!%3D-1:h%3D"moz"%3Bbreak%3Bcase a.indexOf("Opera")!%3D-1:h%3D"o"%3Bbreak%3Bcase a.indexOf("Opera")!%3D-1:h%3D"o"%3Bbreak%7Dm%3Dh%2B"TransformStyle"%3Bd%3Dh%2B"Transform"%3Bc%3Dh%2B"Perspective"%3BperspectiveOrigin%3Dh%2B"PerspectiveOrigin"%3Bn.style%5Bm%5D%3D"preserve-3d"%3Bn.style%5Bd%5D%3D"translateZ(100px)"%3Bfor(var f%3D0,e%3Dn.childNodes.length%3Bf<e%3B%2B%2Bf)%7Bif(n.childNodes%5Bf%5D.nodeType!%3D3%26%26n.childNodes%5Bf%5D.style)%7Bn.childNodes%5Bf%5D.style%5Bc%5D%3D400%7D%7Dvar b%3D%5B%5D%3Bfunction j(s,t)%7Bvar o%3Ds.childNodes,q%3Dt*g%3Bs.style%5Bm%5D%3D"preserve-3d"%3Bfor(var r%3D0,p%3Do.length%3Br<p%3B%2B%2Br)%7Bif(o%5Br%5D.nodeType!%3D3%26%26o%5Br%5D.style)%7Bo%5Br%5D.style%5Bd%5D%3D"translateZ("%2Bq%2B"px)"%3Bb.push(o%5Br%5D)%3Bif(o%5Br%5D.childNodes.length>0)%7Bj(o%5Br%5D,t%2B1)%7D%7D%7D%7Ddocument.onmousemove%3
@mientjan
mientjan / Code generation
Created July 6, 2015 21:03
Code generation
var codes = [];
var charsNumber = '437'.split('');
var charsString = 'CKX'.split('');
var getCharRndString = function(){
return charsString[ Math.floor(Math.random()* charsString.length) ];
}
var getCharRndNumber = function(){
return charsNumber[ Math.floor(Math.random()*charsNumber.length) ];
}
@mientjan
mientjan / Space Inside Example
Created May 22, 2015 16:01
Why i want a space inside
// imagine having a lot of || making it a very long line, you'd want to add newlines to improve readability/editability
// e.g.: if (foo || bar || baz || moo || stuff || thingy) { }
// we use for 4 spaces for tabs and having no space after the if doesn't line it up nicely
if(foo
|| bar)
{
// ..
}