Skip to content

Instantly share code, notes, and snippets.

View loktar00's full-sized avatar
🏠
Working from home

Jason loktar00

🏠
Working from home
View GitHub Profile
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);})();
@loktar00
loktar00 / gist:5404432
Created April 17, 2013 13:45
Console decorations
console.log('%cTHIS IS SO MUCH FUN', 'color:red; background:yellow; font-size: 2em;')
@loktar00
loktar00 / gist:5427189
Last active December 16, 2015 11:28
What is the best way to do this?
/*
*
* What Im trying to get to work
*
*/
function playersGameName(options){
// stuff in here to init whatevs.
}
@loktar00
loktar00 / reoccurringtimer.js
Last active December 21, 2015 11:09
Simple reoccurring timer
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 / Swimming-snakes.markdown
Created January 16, 2014 01:24
A Pen by Jason Brown.

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.

// perf improvement for answer http://stackoverflow.com/questions/20452317/jquery-droppable-iframe-offset
var $scrollParent = m[i].element.closest("html,body");
m[i].offset.top -= $scrollParent.scrollTop();
m[i].offset.left -= $scrollParent.scrollLeft();
// iframe positioning
if (this.current.options.iframeOffset) {
m[i].offset.top += this.current.options.iframeOffset.top;
m[i].offset.left += this.current.options.iframeOffset.left;

So, you want to send a motherfucking XMLHttpRequest (XHR, or commonly and falsly known as AJAX.) Too bad, just ran out of motherfucking XMLHttpRequests; but I still have one regular. XHR is not magic. It does not autofuckinmagically send things the way you want them do be sent. It does not do the thinking for you. It just sends an Http Request.

You get a hold on such a prime beast like this:

@loktar00
loktar00 / chatfavicon userscript
Last active August 29, 2015 14:02
User script for animated favicon on the SO Chatrooms
// ==UserScript==
// @name Favicon update for pinned chat
// @version 0.1
// @description Updates the favicon with the message count
// @match http://chat.stackoverflow.com/*
// ==/UserScript==
var canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'),
origFav = document.querySelector('[rel="shortcut icon"]'),
@loktar00
loktar00 / TFSCheckout.js
Created October 17, 2014 16:23
Checkout only changed files from TFS using gulp and gulp-changed.
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
}));
}
@loktar00
loktar00 / headache.js
Created January 15, 2015 22:15
headache inducer
javascript:(function()%7Bvar%20els%20%3D%20document.querySelector('html')%2CkeyFrames%20%3D%20'%40-webkit-keyframes%20blurAnim%20%7B%200%25%20%7B-webkit-filter%3A%20blur(0.2px)%3B%20%7D40%25%20%7B-webkit-filter%3A%20blur(0.6px)%3B%20%7D80%25%20%7B-webkit-filter%3A%20blur(0.3px)%3B%7D100%25%20%7B-webkit-filter%3A%20blur(0px)%3B%7D%7D'%3Bdocument.styleSheets%5B0%5D.insertRule(keyFrames%2C%200)%3Bels.style.webkitAnimation%20%3D%20'blurAnim%2010s%20infinite'%7D)()