Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jason loktar00

🏠
Working from home
View GitHub Profile
@loktar00
loktar00 / TFSCheckout.js
Created Oct 17, 2014
Checkout only changed files from TFS using gulp and gulp-changed.
View TFSCheckout.js
var fs = require('fs');
// ignore missing file error
function fsOperationFailed(stream, sourceFile, err) {
if (err) {
if (err.code !== 'ENOENT') {
stream.emit('error', new gutil.PluginError('gulp-changed', err, {
fileName: sourceFile.path
}));
}
View Swimming-snakes.markdown

Swimming snakes

Havent done a pen in the longest time, decided to put this demo together after playing around with IK, the effect turned out pretty cool! (in my biased opinion of course)

A Pen by Jason Brown on CodePen.

License.

@loktar00
loktar00 / reoccurringtimer.js
Last active Dec 21, 2015
Simple reoccurring timer
View reoccurringtimer.js
var timer = function (waitTime, callBack, forever, start) {
this.lastTime = Date.now();
this.waitTime = waitTime;
this.forever = forever;
this.running = start;
this.callBack = callBack;
this.tick = function () {
if (this.running) {
if (Date.now() > this.lastTime + this.waitTime) {
@loktar00
loktar00 / gist:5427189
Last active Dec 16, 2015
What is the best way to do this?
View gist:5427189
/*
*
* What Im trying to get to work
*
*/
function playersGameName(options){
// stuff in here to init whatevs.
}
@loktar00
loktar00 / gist:5404432
Created Apr 17, 2013
Console decorations
View gist:5404432
console.log('%cTHIS IS SO MUCH FUN', 'color:red; background:yellow; font-size: 2em;')
View gist:5069593
javascript:(function(){var script=document.createElement('script');script.src='http://github.com/mrdoob/stats.js/raw/master/build/stats.min.js';document.body.appendChild(script);script=document.createElement('script');script.innerHTML='var interval=setInterval(function(){if(typeof Stats==\'function\'){clearInterval(interval);var stats=new Stats();stats.domElement.style.position=\'fixed\';stats.domElement.style.left=\'0px\';stats.domElement.style.top=\'0px\';stats.domElement.style.zIndex=\'10000\';document.body.appendChild(stats.domElement);setInterval(function(){stats.update();},1000/60);}},100);';document.body.appendChild(script);})();
View gist:4675433
/**
* jGame.update()
*
* Main update loop for the game, updates all objects, and calls the renderer.
**/
update : function(){
var curTime = (new Date()).getTime(),
update = this.update;
this.deltaTime = curTime - this.lastTime;
@loktar00
loktar00 / RainbowBright.js
Created Jan 3, 2013
Way overboard on a cool script posted by Rlemon
View RainbowBright.js
function r() {
return Math.floor(Math.random() * 255);
}
function lemon() {
var cycle = parseFloat(this.dataset.cycle);
if(isNaN(cycle)){
cycle = ~~(Math.random()*100);
}
@loktar00
loktar00 / index.html
Created Dec 30, 2012
A CodePen by Jason Brown. Messing around with the audio api - Spent way too long messing with this. Happy New year!
View index.html
<div class="attribution">
<a href="https://soundcloud.com/term-and-conditions-mixes/new-year-dubstep-minimix">New Year Dubstep Minimix By Terms and Conditions</a>
</div><br/>
<canvas id="playCanvas"></canvas>
View robot.js
var Robot = function(robot) {
this.rotate = 360;
this.dist = 0;
this.lastAngle = 0;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.turn(this.rotate);
this.lastAngle = this.rotate;