Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
open -n "/Applications/VLC.app" udp://@239.193.4.128:5000
/Applications/VLC.app/Contents/MacOS/VLC --no-audio udp://@239.193.4.70:5000 &
[
{
"Ministry":"01. Barton (Protectionist), 1 Jan 1901-24 Sept 1903",
"Title":"Minister for External Affairs",
"Name":"Barton, Edmund",
"House":"HR",
"Party":"Protectionist",
"State":"NSW",
"InCabinet":"N/A",
"Start":"1901-01-01",
[{
"ministry": "<ministry identifier>",
"title": "<position title>",
"name": "<minister's name>",
"from": "<start date of ministership>",
"to": "<end date of ministership>"
},{
...
}]
@drzax
drzax / log.js
Created November 15, 2013 01:58
Re-emit a log file generated by Winston.
Tail = require('tail').Tail;
Winston = require('winston');
tail = new Tail('logs/default.log');
logger = new Winston.Logger();
logger.add(Winston.transports.Console, {colorize:true});
tail.on('line', function(data){
var json, date;
try {
/**
* See: http://jsfromhell.com/math/dot-line-length
*
* Distance from a point to a line or segment.
*
* @param {number} x point's x coord
* @param {number} y point's y coord
* @param {number} x0 x coord of the line's A point
* @param {number} y0 y coord of the line's A point
* @param {number} x1 x coord of the line's B point
@drzax
drzax / Page.php
Created October 9, 2012 01:55
A pattern for creating 'singleton' page types in Silverstripe
class Page extends SiteTree {
...
/**
* Override the canCreate method to change the order of processing and allow
* the SingletonPage DataExtension to do its work.
*/
public function canCreate($member = null) {
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
@drzax
drzax / jquery.plugin.js
Created August 8, 2012 09:56
jQuery Plugin Boilerplate
/*
* jQuery.name plugin
* https://github.com/{username}/{plugin-name}
*
* Copyright 2011, {real name}
* {website}
*
* This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
* http://creativecommons.org/licenses/by-sa/3.0/
*/
with(document.documentElement){className=className.replace(/no-js/,'js')}
@drzax
drzax / Useful PHP Arrays
Created July 22, 2011 05:54
Useful PHP Arrays
<?php
// Australian States
array('ACT'=>'Australian Capital Territory', 'NSW'=>'New South Wales', 'NT'=>'Northern Territory', 'QLD'=>'Queensland', 'SA'=>'South Australia', 'TAS'=>'Tasmania', 'VIC'=>'Victoria', 'WA'=>'Western Australia');
@drzax
drzax / headjsgmaps.html
Created February 5, 2011 04:23
A head.js/Google Maps test case
<!DOCTYPE html>
<html>
<head>
<title>head.js / Google Maps test case</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://github.com/headjs/headjs/raw/master/dist/head.load.min.js"></script>
<script>head.js('http://code.jquery.com/jquery-1.5.min.js',"http://maps.google.com/maps/api/js?sensor=false&callback=init_map");</script>
<script>