Skip to content

Instantly share code, notes, and snippets.

Jason Hall ImJasonH

Block or report user

Report or block ImJasonH

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ImJasonH
ImJasonH / timerange.html
Created Jan 24, 2012
HTML abomination to select a time range [0, 23]
View timerange.html
<html>
<head>
<script type="text/javascript">
function get(id) {
return document.getElementById(id);
}
function updateLower() {
var value = get('lower').valueAsNumber;
get('upper').min = value + 1;
@ImJasonH
ImJasonH / foursquare.v2.json
Created Feb 16, 2012
Discovery document for Foursquare API
View foursquare.v2.json
{
"kind": "discovery#restDescription",
"id": "foursquare:v2",
"name": "foursquare",
"version": "v2",
"title": "Foursquare API",
"description": "Is awesome.",
"icons": {
"x16": "https://playfoursquare.s3.amazonaws.com/press/logo/icon-16x16.png"
},
@ImJasonH
ImJasonH / background.html
Created Feb 21, 2012
Dart Chrome extension
View background.html
<html><head>
<script type="application/dart">
main() {
print('hello world');
}
</script>
<script type='text/javascript'>
if (navigator.webkitStartDart) {
navigator.webkitStartDart();
}
View gist:2018190
public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
jsniAlert();
jsniAlertParam("Hello");
jsniAlertParam("World");
}
private static final native void jsniAlert() /*-{
$wnd.alert("Called JSNI alert");
View gist:2018382
public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
doJsni();
}
private static void staticMethod(int num) {
Window.alert("Static method called " + num);
}
private void instanceMethod(String str) {
@ImJasonH
ImJasonH / pubsub.go
Created Sep 6, 2012
Simple HTTP server that enqueues subscribers and sends published messages to the oldest subscriber (and enqueues messages in case there are no subscribers)
View pubsub.go
package main
import (
"io"
"log"
"net/http"
)
const (
buffSize = 100
@ImJasonH
ImJasonH / main.go
Created Dec 12, 2012
Script to copy your GitHub Downloads to Google Cloud Storage
View main.go
/*
First go to https://code.google.com/apis/console, create a project, enable Cloud Storage in the "Services"
tab. Enable billing and create a bucket via the online browser. Then, run this script.
Usage:
$ go build main.go -o copy_downloads && chmod +x copy_downloads && ./copy_downloads \
--repo=SomeGitHubUser/AndARepo
--bucket=google-storage-bucket-that-i-own
(Alternately, the build script is available at http://www.imjasonh.com/copy_downloads)
@ImJasonH
ImJasonH / mustlogin.go
Created Dec 19, 2012
Recipe to require that a user log in before reaching an http Handler func, without specifying it in app.yaml (similar to Python App Engine's @login_required decorator)
View mustlogin.go
package mustlogin
import (
"appengine"
"appengine/user"
"fmt"
"net/http"
)
func init() {
@ImJasonH
ImJasonH / mustoauth.go
Last active Dec 10, 2015
Recipe to require that a user log in and go through an OAuth flow before reaching an http Handler func. This is similar to google-api-python-client's OAuth2Decorator (https://developers.google.com/api-client-library/python/platforms/google_app_engine#Decorators) This is based on the mustlogin.go gist here: https://gist.github.com/4337383
View mustoauth.go
package mustoauth
import (
"appengine"
"appengine/datastore"
"appengine/memcache"
"appengine/urlfetch"
"appengine/user"
"encoding/json"
"fmt"
@ImJasonH
ImJasonH / perler.go
Last active Dec 15, 2015
Go script to read a png image like those found at http://scrollboss.illmosis.net/sprites.php?g=xmen-konamiarc to figure out how to make one with Perler beads (WIP)
View perler.go
package main
import (
"flag"
"fmt"
"image"
"image/color"
"image/png"
"log"
"math"
You can’t perform that action at this time.