Skip to content

Instantly share code, notes, and snippets.

@frio80
frio80 / prototype-private-access.js
Created October 20, 2011 03:15
Accessing privates variables in shared methods on the prototype
// Was always interested if you can share private variables in prototyped methods. And it looks like you can!
function Bank(name) {
this.name = name;
this.messages = [];
}
Bank.prototype = (function() {
var money_total = 500000;
return {
@frio80
frio80 / WordFreq.js
Created November 26, 2011 04:32
Word Frequency in JavaScript
/**
*
* This function takes a list of words and a specified text and returns the frequency of each word.
* The program processes in timed chunks as to not lock the browser up
*
* @param {Array} words This is the list of words to match against
* @param {String} text This is the text to match
* @param {Function} This is the callback function
*
* TODO:
@frio80
frio80 / binary-tree-fun.html
Last active September 16, 2016 22:27
Fun with Binary Tree
<!DOCTYPE html>
<html>
<head>
<title>Binary Tree Fun</title>
<meta charset="UTF-8">
<style>
blink, .blink {
-webkit-animation: blink 1s step-end infinite;
-moz-animation: blink 1s step-end infinite;
-o-animation: blink 1s step-end infinite;