Skip to content

Instantly share code, notes, and snippets.

View tjwudi's full-sized avatar

Di Wu tjwudi

View GitHub Profile

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:

angular.module('App').config(function (RestangularProvider) {
// convert json request to x-www-form-urlencoded request
RestangularProvider.setFullRequestInterceptor(function (el, op, what, url) {
if (op === "put" || op === "post") {
var res = "";
_.forOwn(el, function (v, k) {
if (!_.isFunction(v)) {
res += k + "=" + encodeURIComponent(v) + "&";
@tjwudi
tjwudi / brush.js
Last active August 29, 2015 14:21 — forked from enjalot/brush.js
if(!d3.chart) d3.chart = {};
d3.chart.brush = function() {
var g;
var data;
var width = 600;
var height = 30;
var dispatch = d3.dispatch(chart, "filter");
function chart(container) {
@tjwudi
tjwudi / README.md
Last active August 29, 2015 14:21 — forked from mbostock/.block
@tjwudi
tjwudi / main.yml
Created October 14, 2015 05:13 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']