Skip to content

Instantly share code, notes, and snippets.

View jasperkuperus's full-sized avatar
💭
😎

Jasper Kuperus jasperkuperus

💭
😎
View GitHub Profile
@jasperkuperus
jasperkuperus / DiscriminatorListener.php
Last active July 7, 2023 17:35
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
<?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,
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 / README.md
Created April 4, 2018 17:59
Small example of flicker in react-native-navigation

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

@jasperkuperus
jasperkuperus / winston-stackdriver.js
Last active May 20, 2021 14:26
Winston / Stackdriver severity level
const winston = require('winston');
const { LEVEL } = require('triple-beam');
const SeverityLookup = {
'default': 'DEFAULT',
'silly': 'DEFAULT',
'verbose': 'DEBUG',
'debug': 'DEBUG',
'http': 'notice',
'info': 'info',