Skip to content

Instantly share code, notes, and snippets.

View ajnadel's full-sized avatar

AJ Nadel ajnadel

View GitHub Profile
@ajnadel
ajnadel / mass.js
Created February 11, 2015 23:29 — forked from anonymous/mass.js
var is2through9 = /[2-9]/;
var genElement = function(elm){
var elementCount = 1;
var lastChar = elm[elm.length-1];
if (is2through9.test(lastChar)){
elementCount = lastChar; /* add coefficient */
elm = elm.slice(0, -1);
}
return [elementCount, elm];
@ajnadel
ajnadel / wordcount.html
Created December 15, 2014 20:13
Word Histogram (nice looking)
<!doctype html>
<head>
<title>Word Count</title>
<link href="http://maxcdn.bootstrap
cdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<style>
.container {
padding-top: 40px;
}
.container *{
JSON.encodeURI = function(jsonObject){
var string;
$.each(jsonObject, function(key, value){
string += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(value);
});
return string.slice(1);
}