Skip to content

Instantly share code, notes, and snippets.

View noahadams's full-sized avatar

Noah Adams noahadams

View GitHub Profile
// A key to use for localStorage
var lsKey = "my very unique key"
// Some data to store in it, this could just as easily be from a web service
, dataStore = {
0: {
'name': 'Steven Patrick Morrissey',
'role': 'singer'
},
1: {
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello, World!\n");
return 0;
}
@noahadams
noahadams / mapreduce.js
Created August 6, 2014 21:11
Javascript one-liner recursive map/reduce implementation
function map(arr, func) { return arr.length <= 1 ? [func(arr[0])] : [func(arr[0])].concat(map(arr.slice(1), func)) }
function reduce(arr, func, start) { return arr.length <= 1 ? func(arr[0], start) : func(arr[0], reduce(arr.slice(1), func, start)); }
@noahadams
noahadams / counting_to_ten.py
Created March 7, 2018 18:25
6 Small Python 3 programs that output the numbers 1 to 10
# Example 1
print('1\n2\n3\n4\n5\n6\n7\n8\n9\n10')
# Example 2
i = 1
while i <= 10:
print(i)
i = i + 1
# Example 3