Skip to content

Instantly share code, notes, and snippets.

View wangshijun's full-sized avatar

wangshijun wangshijun

View GitHub Profile
//Practically all this code comes from https://github.com/alangrafu/radar-chart-d3
//I only made some additions and aesthetic adjustments to make the chart look better
//(of course, that is only my point of view)
//Such as a better placement of the titles at each line end,
//adding numbers that reflect what each circular level stands for
//Not placing the last level and slight differences in color
//
//For a bit of extra information check the blog about it:
//http://nbremer.blogspot.nl/2013/09/making-d3-radar-chart-look-bit-better.html
@mat
mat / INSTALL
Created August 12, 2011 19:43
Turn an Ubuntu 10.04 server into a StatsD/Graphite server
TODO:
- edit /opt/statsd/local.js
- correct the graphite host to localhost
- if desired, put 'debug: true' in there
- make the box accessible via the hostname 'graphite'
- update conf/storage-schemas.conf, see example for these retention rules:
6 hours of 10 second data
1 week of 1 minute data
5 years of 10 minute data
@malash
malash / disable-sip.sh
Last active November 17, 2015 05:33
Disable Mac OS X EI Capitan SIP
#!/bin/sh
# Command + R when boot
# open term
csrutil disable
@Kapeli
Kapeli / gist:5017177
Created February 22, 2013 22:43 — forked from yjsoon/gist:3474117
" Search Dash for word under cursor
function! SearchDash()
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
let s:url = "dash://".s:wordUnderCursor
let s:cmd ="silent ! " . s:browser . " " . s:url
execute s:cmd
redraw!
endfunction
map <leader>d :call SearchDash()<CR>
@outmost
outmost / node_beacon.js
Last active December 17, 2015 01:58
Node JS beacon to capture performance metrics from Boomerang.
// Assumptions
// Boomerang makes beacon call to port :8080
// StatsD is running on same server (localhost)
// The following NodeJS modules are installed:
// https://github.com/tobie/ua-parser
// https://github.com/bluesmoon/node-geoip
// Boomerang is configured to send custom parameters for "domain", "page_type", "user_status", "ip" and "user_agent".
// http://lognormal.github.io/boomerang/doc/howtos/howto-5.html
@Ianfeather
Ianfeather / proximity_loader.coffee
Last active December 23, 2015 03:39
Proximity loading for images/social scripts
# Really this is just a proximity_sensor, it will fire whatever event you pass as an arg
# It has nothing to do with loading, that's just how we've used it so far
required = if window.lp.isMobile then 'jsmin' else 'jquery'
define [required, 'lib/extends/events'], ($, EventEmitter) ->
class ProximityLoader
for key, value of EventEmitter
@yjsoon
yjsoon / gist:3485271
Created August 27, 2012 03:22
vim search Dash for word under cursor, filetype-specific
" Searches Dash for the word under your cursor in vim, using the keyword
" operator, based on file type. E.g. for JavaScript files, I have it
" configured to search j:term, which immediately brings up the JS doc
" for that keyword. Might need some customisation for your own keywords!
function! SearchDash()
" Some setup
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
@addyosmani
addyosmani / browserify.md
Last active March 28, 2016 02:06
Yeoman + Browserify

Yeoman generators with Browserify

Browserify is a tool that allows us to write node-style modules that compile for use in the browser. Like node, we write our modules in separate files, exporting external methods and properties using the module.exports and exports variables

generator-browserify is a generator with a Browserify setup, offering choices between Gulp or Grunt and Foundation or Bootstrap.

screenshot 2014-04-20 at 10 19 09 pm

generator-angular-with-browserify is a generator for bundling Angular.js with Browserify

@icflorescu
icflorescu / app.coffee
Last active April 20, 2016 02:15
Complex routing with express.js + CoffeeScript
###
It's incredibly easy to set-up a complex, SEO-friendly routing system using
the powerful CoffeeScript regular expressions and destructuring assignment syntax (to parse/name route parameters).
For instance, the code snippet below will respond to routes like:
/offers/category-automobiles
/offers/category-automobiles/make-alfa-romeo
/offers/category-automobiles/make-alfa-romeo/model-159
@josephg
josephg / server.js
Created May 12, 2016 00:58
Slow requires
var tree = require("terminal-tree");
const loadingData = [];
var current = loadingData;
global.wr = (_require) => {
return (name) => {
const start = Date.now();
const parent = current;
current = [];