Skip to content

Instantly share code, notes, and snippets.

View DavidSouther's full-sized avatar
💭
You can statistics syntax, not semantics.

David Souther DavidSouther

💭
You can statistics syntax, not semantics.
View GitHub Profile
<!DOCTYPE html>
<head>
<title>QUnit Test Page</title>
<link rel="stylesheet" href="libs/qunit-1.12.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="libs/qunit-1.12.0.js"></script>
</body>
@DavidSouther
DavidSouther / app.js
Created June 9, 2015 00:17
Rupert Basic Example
var config = {
name: "rupert-basic-example",
stassets: {
root: './src/client'
}
};
require('rupert')(config).start();
@DavidSouther
DavidSouther / app.js
Last active August 29, 2015 14:22
Rupert API Example
var config = {
name: "rupert-api-example",
stassets: {
root: './src/client'
},
server: {
root: './src/server'
}
};
@DavidSouther
DavidSouther / app.js
Created June 10, 2015 01:32
Rupert Plugins (Mongo) example
var config = {
name: 'rupert-basic-example',
stassets: {
root: './src/client'
},
server: {
root: './src/server'
}
};
var config = {
name: 'rupert-auth-example',
hostname: 'localhost',
stassets: {
root: './src/client'
},
server: {
root: './src/server'
},
mongo: {
@DavidSouther
DavidSouther / drag-directive.js
Created September 3, 2015 17:04
A hastily sanitized demo of a Draggable directive.
var log = debug('draggable');
function Draggable(element, scope){
var apply;
if(scope.$apply){
apply = function(fn){
return function(){
var context = this;
var args = arguments;
@DavidSouther
DavidSouther / drag-directive.js
Last active September 3, 2015 17:20
An Angular 1.x dragging directive. The drag directive has several callback attributes available, the main being drag itself. For every drag event, the component has an opportunity to update itself.
var log = debug('draggable');
function Draggable(element, scope){
var apply;
if(scope.$apply){
apply = function(fn){
return function(){
var context = this;
var args = arguments;
/**
* Calculate the specificity of a selectorList (the sum of the count of
* matching attributes).
*/
var specificity = function(selectorList) {
var spec = 0;
goog.array.forEach(selectorList, function(selector){
spec += selector.hierarchy?1:0;
spec += selector.type?1:0;
spec += selector.id?1:0;
@DavidSouther
DavidSouther / firefox-install.sh
Created April 29, 2012 13:50
Install Firefox releases
mkdir --parents /home/$USER/devel/firefox
mkdir --parents /home/$USER/bin
pushd /home/$USER/devel/firefox
for ff in $(seq 4 13) ; do
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$ff.0/linux-$(uname -p)/en-US/firefox-$ff.0.tar.bz2
tar xvf firefox-$ff.0.tar.bz2
mv firefox firefox-$ff
/home/$USER/devel/firefox/firefox-$ff/firefox -no-remote -CreateProfile firefox-$ff.0
@DavidSouther
DavidSouther / gist:3220550
Created July 31, 2012 21:06
Timing functions in LiveScript
polynomial = (coefficients) ->
n = 0
coefficients = reverse coefficients
(x = n++) ->
sum = 0
for c, i in coefficients
sum += c * Math.pow(x, i)
sum
linear = (a = 1, b = 0) ->