This file contains hidden or 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
(function (libraryNamespace, $, undefined) { | |
// private properties | |
var privateProperty = 'default private'; | |
// public properties | |
libraryNamespace.publicProperty = 'default public'; | |
// private methods | |
function updatePublicProperty(newPublic) { | |
this.publicProperty = newPublic || 'new public'; |
This file contains hidden or 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
/* | |
TrafficCop | |
Author: Jim Cowart | |
License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license) | |
Version 0.1.0 | |
*/ | |
(function($, undefined) { | |
var inProgress = {}; |
This file contains hidden or 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
'use strict'; | |
module.exports = function(grunt) { | |
grunt.registerTask('runTests', '', function() { | |
var done = this.async(); | |
grunt.util.spawn({ | |
cmd: 'node', | |
args: ['./js/tests/runner/tests.js'] | |
}, function(e, result) { |
This file contains hidden or 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
tree = { | |
a: ['b', 'c', 'd'], | |
b: ['e', 'f'], | |
c: ['g', 'h'], | |
h: ['i', 'j', 'k'], | |
k: ['l'], | |
l: ['m', 'n'] | |
} | |
var _ = require('underscore'); |
This file contains hidden or 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 = function(grunt) { | |
grunt.registerTask('walk-ast', function() { | |
grunt.log.writeln('walking'); | |
var file = require('file'); | |
var uglify = require('uglify-js'); | |
var result = []; | |
function walkAST(node) { | |
if (node instanceof uglify.AST_If) { | |
if (node.condition) { |
This file contains hidden or 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
// somehow when running this in node I get strange numbers for the distribution of the final "random" number | |
// this assumes a lottery system of 6 balls, 5 picked randomly from a batch of 39 and the final one from 8 | |
var fastLottery = function() { | |
var count = 0; | |
var running = true; | |
var distribution = [0, 0, 0, 0, 0, 0, 0, 0]; | |
var finalCount = 0; | |
while (running) { | |
count++; |
This file contains hidden or 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
// based on standard powerball lotto of 69 balls for the first 5 and 26 for the "power ball" | |
// note that this could potentially run forever, running in node should take ~30min but be warned, the browser is much slower! | |
var _ = require('underscore'); | |
var balls = []; | |
var powerball = []; | |
for(var i = 1; i < 70; i++) { | |
balls.push(i); | |
} | |
for(i = 1; i < 27; i++) { |
This file contains hidden or 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
var count = 0; | |
var run = function() { | |
var rand = Math.floor((Math.random() * 292000000)) + 1; | |
var check = 0; | |
while(true) { | |
check = Math.floor((Math.random() * 292000000)) + 1; | |
if(check === rand) { | |
break; | |
} | |
rand = Math.floor((Math.random() * 292000000)) + 1; |
This file contains hidden or 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
<input id="button" type="button" value="WHAT'S MY LUCK!?!" onclick="return window.run()" /> | |
<h1 id="results"></h1> | |
<script type="text/javascript"> | |
var count = 0; | |
var result = ''; | |
window.run = function() { | |
console.log('running'); | |
var rand = Math.floor((Math.random() * 292000000)) + 1; | |
var check = 0; | |
while(true) { |
This file contains hidden or 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
const keyElements = document.querySelectorAll('.key'); | |
const audioElements = document.querySelectorAll('audio'); | |
const sounds = {}; | |
const keys = {}; | |
// got this from wes bos | |
function removeTransition (e) { | |
if (e.propertyName !== 'transform') return; | |
e.target.classList.remove('playing'); | |
} |
OlderNewer