Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
😎

Jasper Kuperus jasperkuperus

💭
😎
View GitHub Profile
@jasperkuperus
jasperkuperus / winston-stackdriver.js
Last active May 20, 2021
Winston / Stackdriver severity level
View winston-stackdriver.js
const winston = require('winston');
const { LEVEL } = require('triple-beam');
const SeverityLookup = {
'default': 'DEFAULT',
'silly': 'DEFAULT',
'verbose': 'DEBUG',
'debug': 'DEBUG',
'http': 'notice',
'info': 'info',
@jasperkuperus
jasperkuperus / README.md
Created Apr 4, 2018
Small example of flicker in react-native-navigation
View README.md

Just create a new React Native project as shown in RN's Getting Started. Then run yarn add react-native-navigation and replace the contents of index.js with the code below.

I've run example this with

  • React Native 0.54.3
  • React Native Navigation 1.1.428

Refresh the app and press both tabs. Once in every ~7 times you can see

View stateMock.js
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@jasperkuperus
jasperkuperus / DiscriminatorListener.php
Last active Dec 2, 2021
This gist shows you how to define your discriminator maps at child level in doctrine 2. Why? Because your parent class shouldn't be aware of all it's subclasses. Please read my article for more explanation: https://medium.com/@jasperkuperus/defining-discriminator-maps-at-child-level-in-doctrine-2-1cd2ded95ffb
View DiscriminatorListener.php
<?php
namespace My\Namespace;
/**
* This Listener listens to the loadClassMetadata event. Upon this event
* it hooks into Doctrine to update discriminator maps. Adding entries
* to the discriminator map at parent level is just not nice. We turn this
* around with this mechanism. In the subclass you will be able to give an
* entry for the discriminator map. In this listener we will retrieve the
* load metadata event to update the parent with a good discriminator map,