Skip to content

Instantly share code, notes, and snippets.

Michael Scharf scharf

Block or report user

Report or block scharf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MiniRouter.ts
import { reaction } from 'mobx';
import { Store } from '../store/Store';
// when parcel reloads the page, we have to unsubscribe the old listener...
let oldListener: any;
// this is inspired by https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37
// TODO this is way to simple!!!!!!
export class MiniRouter {
constructor(private readonly store: Pick<Store, 'view'>) {
@scharf
scharf / QueryStringParser.ts
Created May 25, 2018
Mongo Query String Parser
View QueryStringParser.ts
import { toDateOrNull } from '../toDate';
function substituteQuotedCharacters(inner: string) {
return inner.replace(/\\./g, function(s) {
switch (s[1]) {
case 'n':
return '\n';
case 't':
return '\t';
case 'r':
View toDate.ts
/**
* Tries to return a valid date or null. It can parse (valid) date strings as well as numbers.
* @param date a valid date or null
*/
/**
* Tries to return a valid date or null. It can parse (valid) date strings as well as numbers.
*
* @param val
* @param defaultValue
* @returns {any}
@scharf
scharf / app-ntest.js
Created Apr 2, 2015
require all tests
View app-ntest.js
'use strict';
// to get intellij navigation correctly, we need
// static imports. Therefore we dynamically create
// a test file that imports all tests we want to run...
var globule = require('globule');
var path = require('path');
var fs = require('fs');
You can’t perform that action at this time.