This file contains 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
document.addEventListener('focusin', (e) => | |
// Sanity check for target being activeElement, should always be true | |
console.log('focusin', e.target === document.activeElement, document.activeElement) | |
); | |
document.addEventListener('focusout', (e) => | |
// Sanity check that activeElement is body, should always be true | |
console.log('focusout', document.body === document.activeElement) | |
); |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains 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
948185325142024192 | |
141671778 | |
1595919655 | |
859375579 | |
1310776698 | |
3017785207 | |
628899279 | |
888323120 | |
4802917600 | |
308660195 |
This file contains 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
// Overload a function according to the types of arguments passed in: | |
// | |
// var fn = overloadByTypes({ | |
// 'object': function(object) {}, | |
// 'string number': function(string, number) {}, | |
// 'default': function() {} | |
// }); | |
// | |
// Returns the result of the called function. To return this to create | |
// a chainable method, for example, pass in true as a second argument: |
This file contains 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
// Viterbi algorithm for finding hidden relationships | |
function Viterbi(data) { | |
var V = [{}]; | |
var path = {}; | |
// Initialize base cases (t == 0) | |
for(var i=0;i<data.states.length;i++) { | |
var state = data.states[i]; | |
V[0][state] = data.start_probability[state] * data.emission_probability[state][data.observations[0]]; | |
path[state] = [state]; |
This file contains 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(jQuery) { | |
var win = jQuery(window); | |
var sampleLength = 20; | |
var maxInterval = 250; | |
var avgInterval = 35; | |
var timeStamps = []; | |
function diff(n, i, array) { | |
return array[i + 1] - n; | |
} |
This file contains 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(jQuery, undefined){ | |
// Cycle news slides | |
jQuery(document).ready(function(){ | |
var slides = jQuery('.header_slide'), | |
length = slides.length, | |
i = slides.index(slides.filter('.active')[0]), | |
durationShort = 8000, | |
durationLong = 48000, | |
timer, fn; | |
This file contains 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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller | |
// fixes from Paul Irish and Tino Zijdel | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { |
This file contains 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
// jQuery.addEasing(string) | |
// | |
// Interprets and adds easing functions to jQuery.easing | |
// according to the CSS spec for transition timing functions. | |
// | |
// e.g. | |
// jQuery.addEasing('cubic-bezier(0.4, 0.2, 0.66, 1)'); | |
(function(jQuery, undefined){ | |
This file contains 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
.whatever { | |
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset; | |
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset; | |
-o-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset; | |
box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset; | |
} |