Skip to content

Instantly share code, notes, and snippets.

@slawrence
slawrence / gist:5364061
Created April 11, 2013 14:56
npm debug-log
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli 'C:\\Users\\slawrence1\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'karma@canary' ]
2 info using npm@1.2.17
3 info using node@v0.8.18
4 verbose read json C:\dev\svn\pe2e.trunk\pe2e\pe2e-web\webapp\package.json
5 warn package.json ats-pe2e-webapp-build@0.0.3 No README.md file found!
6 verbose read json C:\dev\svn\pe2e.trunk\pe2e\pe2e-web\webapp\node_modules\commander\package.json
@slawrence
slawrence / schemanator.js
Created February 7, 2013 22:09
A basic "schema" generator/comaparator. Requires underscore for deep compare.
/*global _.isEqual, console, schemanator: true */
/*jslint browser: true */
(function () {
'use strict';
if (window.schemanator) {
console.error("schemanator already defined");
return;
}
/**
document.getElementById('results').innerHTML = (function (suits, ranks) {
var cards = [], i, j;
for (i = 0; i < suits.length; i += 1) {
for (j = 0; j < ranks.length; j += 1) {
cards.push(suits[i] + ranks[j]);
}
}
return cards;
}(['S', 'H', 'C', 'D'], [ '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']))
.sort(function (a, b) {
@slawrence
slawrence / tree.js
Created November 20, 2012 20:44
treeify.js
/*jslint browser: true*/
/*global pn: true, Tree: true */
pn = window.pn || {};
(function () {
if (pn.Tree) {
console.error('Tree is already defined!');
return;
}
/**
@slawrence
slawrence / kaprekar.js
Created November 20, 2012 20:43
kaprekar.js
var num = "174";
kaprekar(num);
function kaprekar(num){
s1 = parseInt(num.split("").sort().join(""));
s2 = parseInt(num.split("").sort(function(a,b){return b-a}).join(""));
n = (s1 > s2) ? s1 -s2 : s2 - s1;
if(n === parseInt(num)){
return n;