Skip to content

Instantly share code, notes, and snippets.

@calvinf
calvinf / .ackrc
Last active June 10, 2020 22:11
ackrc (ack config dotfile)
--color
--recurse
--html
--css
--js
--java
--type-add=typescript=.ts,.tsx
--typescript
--type-add=graphql=.graphql
--graphql
@calvinf
calvinf / mobile-meta-links.html
Created March 31, 2012 00:55
iOS Web App Configuration
@calvinf
calvinf / multiplication-table.js
Created July 17, 2012 18:12
Multiplication Table in node.js
var util = require('util'),
sprintf = require('sprintf').sprintf, // npm install sprintf
rows = 10
for(var i=1;i<=rows;i++) {
for(var j=1;j<=rows;j++) {
var num = sprintf('%3d', i * j)
process.stdout.write(num + " ")
}
process.stdout.write("\n")
@calvinf
calvinf / getCSSUrls.sh
Created July 26, 2012 01:16
ack command for CSS URL regex
ack 'url\(.*?(?!_V)\)' --css -o
@calvinf
calvinf / pr.md
Created March 25, 2013 18:47 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@calvinf
calvinf / .tmux.conf
Last active June 2, 2017 01:40
Tmux Configuration
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Copy mode stuff
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'x' copy-selection
bind-key 'p' run-shell "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind-key 'y' send-keys x\; run-shell "tmux save-buffer - | reattach-to-user-namespace pbcopy"\; display-message "copied"
@calvinf
calvinf / pre-push.py
Created September 4, 2013 20:51 — forked from co3k/pre-push.py
#!/usr/bin/env python
import sys, os
info = sys.stdin.read().strip().split(" ")
range = ""
if info:
range = "{}..{}".format(info[3], info[1])
sys.stdin = open('/dev/tty')

JavaScript Testing with Grunt, Mocha and Chai

In the following post I would like to introduce one way how you can setup your testing workflow for JavaScript development. The central components in the testing environment are Grunt, Mocha and Chai that I will cover from the introduction and installation of each component to the cooperation of all components for the execution of tests.

If you are already an experienced Grunt user and just look for the Gruntfile.js and the Mocha / Chai setup just skip the central components section and skip to the installing components part.

You can find the sample project with all code at GitHub on: https://github.com/maicki/sample-js-testing-grunt-mocha-chai

Central Components

@calvinf
calvinf / HighlightCode.md
Last active August 29, 2015 13:57 — forked from jimbojsb/gist:1630790
Highlight code for inclusion on slide in Keynote

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@calvinf
calvinf / TestingTools.md
Last active August 29, 2015 14:04
Testing Tools

Testing Tools

Java

It's a language. Oracle owns it, and it works well for many things.

Unit testing. The original Java unit testing tool. It's pretty great.

Great for mocking classes.