Skip to content

Instantly share code, notes, and snippets.

View jhuttner's full-sized avatar

Joseph Huttner jhuttner

View GitHub Profile
{"foo":"bar"}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
<html>
<body>
<h1>hello, david</h1>
</body>
</html>
@jhuttner
jhuttner / appathon-ideas.txt
Created March 13, 2012 15:33
Appathon Ideas
# Use GitHub in some way
# Use MongoDB in same way
# Use Git in some way
# Use EC2 in some way
# Use Rackspace in some way.
# Idea - hosting platform for apps.
# Idea - create and push an app in ten minutes. Like, make an app really quickly.
Like, what if you included a PHP file (lib.php) and could start making calls immediately. So we don't just provide library code => we actually provide the compute.
def inside_circle(p1, p2):
# Return true if p1,p2 is contained within the unit cirle
return 0.5 > (((0.5 - p1) ** 2 + (0.5 - p2) ** 2) ** 0.5)
def appx_pi():
inside = 0
total = 0
while True:
p1 = random.random()
function getName(callback) {
client.select('name from people', function(err, result) {
if (err) {
callback(err);
return;
} else {
// process result
}
});
}
@jhuttner
jhuttner / gist:1627527
Created January 17, 2012 17:08
code-boss-proposal-config.json
[
{
"uid": "jhuttner",
"owner": "jhuttner",
"directories": ["/usr/local/adnxs"]
},
{
"uid": "jhuttner-personal",
"owner": "jhuttner",
"directories": ["/home/jhuttner/git-repos"]
@jhuttner
jhuttner / gist:1619424
Created January 16, 2012 06:37
alerter.js
function alerter(start, finish) {
for (var i=0; i<=5; i++) {
setTimeout(function() {
alert(i);
}, i*1000)
}
}
if (!items_by_name[name]) {
items_by_name[name] = [];
}
items_by_name[name].push(item);
// could we do something like this?
items_by_name[name].smart_push(item, [])
@jhuttner
jhuttner / eachWhile.js
Created October 21, 2011 21:12
eachWhile
var add_to_list = false;
var result = [];
$.each(checks, function(check) {
// don't go through all the logic if we know we are going to append it
if (add_to_list) {
return true;
}
if (check()) {
addToList = true;
<?php
function splitArray($array) {
$array = $this->quoteArray($array);
$fields = array_keys($array);
$fields_with_ticks = array();
foreach($fields as $f) {
$fields_with_ticks[] = '`'.$f.'`';
}
$values = array_values($array);