Skip to content

Instantly share code, notes, and snippets.

@biern
biern / snakeNaming.ts
Last active November 22, 2019 12:33 — forked from recurrence/snake_naming.ts
TypeORM Snake Case Naming Strategy
import { NamingStrategyInterface, DefaultNamingStrategy } from 'typeorm';
import { snakeCase } from 'typeorm/util/StringUtils';
export class SnakeNamingStrategy extends DefaultNamingStrategy
implements NamingStrategyInterface {
tableName(className: string, customName: string): string {
return customName ? customName : snakeCase(className);
}
columnName(
@biern
biern / main.js
Last active March 5, 2018 15:57
Yeelight Screen Ambience
'use strict';
const Color = require("color");
const Yeelight = require('node-yeelight-wifi');
const robot = require('robotjs');
const net = require('net');
const os = require('os');
const R = require('ramda');
@biern
biern / RNP.purs
Last active November 2, 2017 21:03
Purescript Reverse Polish Notation
module RPN where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.Array ((:))
import Data.Either (Either(..))
import Data.Foldable (foldM)

Keybase proof

I hereby claim:

  • I am biern on github.
  • I am biern (https://keybase.io/biern) on keybase.
  • I have a public key ASBwWIcI3iKVq8bCU4SfA1b5xfqE0bEKxVGkraoI4nWIHgo

To claim this, I am signing this object:

defmodule Life.Game do
@type cell :: {integer, integer}
@type state :: [cell]
@adjacency_offsets [
{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
{0, 1}, {1, -1}, {1, 0}, {1, 1},
]
@spec next(state) :: state
@biern
biern / RouteTest.js
Created May 28, 2017 17:30
Render Route with enzyme shallow() proof of concept
import React from 'react';
import { Route } from 'react-router-dom';
export default class RouteTest extends React.PureComponent {
render() {
return (
<div>
<Route path="/hello" render={() => (<div>Hello world!</div>)} />
</div>
body {
font-size: 50pt;
}
.rot-headline {
font-size: 200pt;
position: absolute;
text-align: center;
}
#!/bin/bash
hash make 2>&- || { echo >&2 "I require make but it's not installed. Aborting."; exit 1; }
hash autoreconf 2>&- || { echo >&2 "I require aureconf but it's not installed. Aborting."; exit 1; }
hash unzip 2>&- || { echo >&2 "I require unzip but it's not installed. Aborting."; exit 1; }
hash svn 2>&- || { echo >&2 "I require svn but it's not installed. Aborting."; exit 1; }
function errorcheck(){
if [ "$?" -gt 0 ]; then
@biern
biern / .bashrc
Created August 5, 2011 23:00
alwaysdata config
export PYTHONPATH=~/modules/
export PATH=~/modules/bin:~/modules/:$PATH
export WORKON_HOME=$HOME/.virtualenvs
source ~/modules/virtualenvwrapper.sh
export PIP_REQUIRE_VIRTUALENV=true
export PIP_RESPECT_VIRTUALENV=true
export PIP_VIRTUALENV_BASE=$WORKON_HOME
# source .bash_profile
@biern
biern / quiz.py
Created June 10, 2011 12:07
Simple script parsing questions from a plain text file and making a quiz from them.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import random
import sys
import subprocess
from optparse import OptionParser