Skip to content

Instantly share code, notes, and snippets.

@jklmli
jklmli / fe-regression-testing.md
Last active January 18, 2017 02:23
Better FE Regression Testing

Development Values:

  • ease of feature development
  • avoid coupling with tests

Testing values:

  • ease of test development
  • avoid breakages
  • make breakages easy to fix

Current workflow:

@jklmli
jklmli / .tmux.conf
Last active December 20, 2016 08:57
.tmux.conf
set -g default-terminal "screen-256color"
# http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
@jklmli
jklmli / .gitconfig
Last active August 19, 2017 22:50
.gitconfig
[user]
email = redacted@redacted
name = Kevin Li
[alias]
df = diff --stat
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
rec = !git for-each-ref --sort='-authordate:relative' --format='%(color:red)%(objectname:short) %(color:white)- %(color:yellow)(%(refname:short)) %(color:white)%(subject) %(color:green)(%(authordate:relative)) %(color:bold blue)<%(authorname)>' refs/heads | more -R
sh = show --stat
st = status -sb
@jklmli
jklmli / config.js
Last active May 3, 2016 21:34
webpack.config.json
var path = require('path');
//var HappyPack = require('happypack');
//var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
var LessAutoprefixer = require('less-plugin-autoprefix');
//var webpack = require('webpack');
module.exports = {
entry: './front/src/js/app/app.ts',
output: {
@jklmli
jklmli / gist:4b50e1c6c2720b42bc5d
Last active August 29, 2015 14:24
Get most recent branches in git
git for-each-ref --sort='-authordate:relative' --format='%(color:red)%(objectname:short) %(color:white)- %(color:yellow)(%(refname:short)) %(color:white)%(subject) %(color:green)(%(authordate:relative)) %(color:bold blue)<%(authorname)>' refs/heads | more -R`
# Or in `.gitconfig / [alias]`,
rec = !git for-each-ref --sort='-authordate:relative' --format='%(color:red)%(objectname:short) %(color:white)- %(color:yellow)(%(refname:short)) %(color:white)%(subject) %(color:green)(%(authordate:relative)) %(color:bold blue)<%(authorname)>' refs/heads | more -R
@jklmli
jklmli / Super.ts
Last active March 22, 2018 23:17
import Immutable = require('immutable');
import Monapt = require('monapt');
class Super {
static prototypeHistory: Immutable.Map<any, Immutable.Stack<any>> =
Immutable.Map<any, Immutable.Stack<any>>();
static get<T>(object: any, property: string): T {
let value: T;
val lines: Array[String] = scala.io.Source.fromFile(args(0)).getLines().toArray
val numberOfLinesToRead: Int = lines.head.toInt
lines
.tail
.take(numberOfLinesToRead)
.zipWithIndex
.foreach{case (str: String, index: Int) => {
val validCharacters: String = str
.filter { Character.isLetter(_) }
@jklmli
jklmli / gist:2416824
Created April 18, 2012 21:45
Scala bible's implementation of an N-Queens solver.
def queens(n: Int): List[List[(Int, Int)]] = {
def placeQueens(k: Int): List[List[(Int, Int)]] =
if (k == 0)
List(List())
else
for {
queens <- placeQueens(k - 1)
column <- 1 to n
queen = (k, column)
if isSafe(queen, queens)
@jklmli
jklmli / original
Created June 6, 2011 05:24
zerofillstr.py
#!/usr/bin/env python
def zeroFillStr(inputString, numOfZeros):
# for clarity, used str concat instead of str formatting
return re.sub( '\d+',
lambda matchObj:
('%0' + str(numOfZeros) + 'i') % int(matchObj.group(0)),
inputString )
@jklmli
jklmli / sum
Created May 17, 2011 02:02 — forked from anonymous/sum
#!/usr/bin/env python
print("type integers, each followed by Enter; or ^D or ^Z to finish")
total = 0
count = 0
while True:
try:
line = input()
if line:
number = int(line)