Skip to content

Instantly share code, notes, and snippets.

View jsoendermann's full-sized avatar

Jan Söndermann jsoendermann

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jsoendermann on github.
  • I am jsoendermann (https://keybase.io/jsoendermann) on keybase.
  • I have a public key whose fingerprint is 9AD4 1092 7FC9 294A 8F7C 0488 66C4 BA6A D452 476A

To claim this, I am signing this object:

@jsoendermann
jsoendermann / cluster.js
Created March 21, 2017 08:26
Simple clustering
const EPSILON = 0.1
const cluster = (array, threshold) => {
for (const e of array) {
return array.filter(e_ => Math.abs(e - e_) < EPSILON).length / array.length >= threshold
}
}
if (
cluster([0, 0.0001, 0.01, 0.0, 9], 0.5) &&
@jsoendermann
jsoendermann / mongo.md
Last active April 24, 2017 05:58
Mongo styleguide

MongoDB Style Guide

General

  • Don't mix types. Do be conservative in what you write liberal in what you accept
  • Don't use the empty string or 0 for their falsiness. Do make non-casting, explicit comparisons

Enums

  • Don't use numbers, booleans or any other types to model enumerations. Do model them as uppercase string constants, e.g. "WAITING", "IN_PROGRESS" and "COMPLETED".
@jsoendermann
jsoendermann / rn-native-pro-cons.md
Last active July 10, 2017 03:05
React Native vs Native

React Native

+++ Our team has lots of experience with JavaScript + React

+++ Build once for both platforms

++ Much better developer experience (faster turnaround times)

+ Can update without having to go through the app store most of the time

@jsoendermann
jsoendermann / project-names.md
Last active August 11, 2017 04:40
Project Names
  • angry ant
  • bashful bee
  • cunning cod
  • dodgy dove
  • edgy eel
  • fidgety frog
  • gregarious giraffe
  • hapless hedgehog
  • inept impala
  • jovial jaguar
@jsoendermann
jsoendermann / gitlg.sh
Created December 26, 2017 08:54
git lg
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@jsoendermann
jsoendermann / Dockerfile
Last active June 27, 2018 04:17
Serve jekyll site with nginx
FROM alpine:3.7 as build-env
MAINTAINER Jan Soendermann
# This list of packages was taken from the official jekyll image.
# Some of them are probably not required but since this is
# just a build env, it doesn't matter so much.
RUN \
apk --update add readline readline-dev libxml2 libxml2-dev libxslt \
libxslt-dev python zlib zlib-dev ruby ruby-dev yaml \
yaml-dev libffi libffi-dev build-base nodejs ruby-io-console \
interface RowSegment {
width: number
canStartLine?: boolean | undefined
canEndLine?: boolean | undefined
}
// This implementation isn't fully currect since it never backtracks more than one element but it's good enough for now
export const sentenceLayoutAlgo = <T extends RowSegment>(
rowSegments: T[],
lineWidth: number,
@jsoendermann
jsoendermann / decoratorTest.ts
Created November 30, 2016 00:12
TypeScript decorator that changes method type signature
// tsconfig.json:
// {
// "compilerOptions": {
// "target": "es6",
// "experimentalDecorators": true
// }
// }
const decorator = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
const originalMethod = descriptor.value;
@jsoendermann
jsoendermann / PortraitStyleTransfer.py
Created October 6, 2019 10:39 — forked from titu1994/PortraitStyleTransfer.py
Partial implementation of "Painting Style Transfer for Head Portraits using Convolutional Neural Networks".
from scipy.misc import imread, imresize, imsave
from scipy.optimize import fmin_l_bfgs_b
import numpy as np
import time
import os
import argparse
import h5py
from keras.models import Sequential
from keras.layers.convolutional import Convolution2D, ZeroPadding2D, AveragePooling2D, MaxPooling2D