Working through @chrisdickinson's guide to JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>North Pole</title> | |
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v2.2.0/d3.js"></script> | |
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v2.2.0/d3.geo.js"></script> | |
<style type="text/css"> | |
svg { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Maori +------------> Poor/Fair Self Related Health | |
+ ^ ^ ^ | |
| | | | | |
| Age-----+ | | | |
| ++ | + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import sqlite3 as lite | |
import subprocess | |
from itertools import chain | |
from time import time | |
import sys | |
#import logging | |
#logging.basicConfig(level=logging.DEBUG) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
G = ggplot(data = frame | |
, aes(x = 10 | |
, label = New.HIV.Infections.due.to.MTCT | |
, y = sqrt(New.HIV.Infections.due.to.MTCT) | |
, fill = contribution.to.global.MTCT.burden))+ | |
geom_bar( stat= "identity", position = "identity") | |
#This will make a stacked bar chart with one column, with colors determined by the contribution to the global burden. | |
#I'm going to map x to angle and y to radius (hence the square root above) | |
G = G+theme_bw()+opts(axis.text.x = theme_blank(), legend.position = "bottom", axis.ticks = theme_blank() )+coord_polar(theta = "x") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suite("name of test suite", function(require) { | |
var MapPicker = require('../../require/some/module') | |
test('test something', function() { | |
assert.equal(some, things) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# varsort: reorder lines according to length. | |
cat $0 | awk '{print length($0), $0}' | sort -n | tac | cut -d' ' -f2- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
E = require('events').EventEmitter | |
function fn(ready, eventArg) { | |
var result = // do some async stuff with to compute result | |
if(/* error encountered */) { | |
ready(new Error) | |
} | |
ready(null, result) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = simple_post | |
var USER_AGENT = require("./user_agent") | |
, oauth = require("./OAuth") | |
, request = require("request") | |
, open = require("open") | |
, path = require("path") | |
, ap = require("ap") | |
, fs = require("fs") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for event := range clientData { | |
message, err := event.Encode() | |
if err != nil { | |
goto EXIT | |
} | |
_, err = fw.Write(message) | |
if err != nil { |
OlderNewer