Skip to content

Instantly share code, notes, and snippets.

View ajnadel's full-sized avatar

AJ Nadel ajnadel

View GitHub Profile
JSON.encodeURI = function(jsonObject){
var string;
$.each(jsonObject, function(key, value){
string += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(value);
});
return string.slice(1);
}
@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 *{
@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];
#include <stdio.h>
int main(){
for (int i = 0; i < 100; i++){
if (i % 15 == 0) {
printf("FizzBuzz\n");
} else if (i % 3 == 0){
printf("Fizz\n");
} else if (i % 5 == 0){
printf("Buzz\n");
hello, goodbye, re = ARGV
print hello
puts " and #{goodbye}"
object FizzBuzz {
def main(args: Array[String]){
for( i <- 1 to 100){
if (i%15 == 0)
println("FizzBuzz")
else if (i%3 == 0)
println("Fizz")
else if (i%5 == 0)
println("Buzz")
else
{
"name": "data-vis-intro",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "6to5-node server.js"
},
"author": "",
var F = require('fractional').Fraction;
var colors = require('colors'); /* unused */
var hardLimit = 20; /* times */
var divisor = eval(process.argv[2]);
var value = 0;
var path = '';
var m ='';
for (var i = 1; i < hardLimit; i++) {
var res = Math.pow(divisor, i);
Array.prototype.toLinkedList = function(){
var lastElement = {data: this[this.length-1], next: undefined};
for (var i = this.length - 2; i >= 0; i--){
lastElement = {data: this[i], next: lastElement};
}
return lastElement;
};
/* USAGE:
node webD.js [dictionaryfile] [hashalgo]
*/
var crypto = require('crypto');
var fs = require('fs');
/* SETUP */
var target = 'xQj73CykeTXZoUXgeMxvh9IdBIk';