Skip to content

Instantly share code, notes, and snippets.

View sethladd's full-sized avatar

Seth Ladd sethladd

View GitHub Profile
@sethladd
sethladd / appcache.manifest
Created October 28, 2010 05:39
Example App Cache manifest file which caches resources locally to be used offline.
CACHE MANIFEST
CACHE:
index.html
pattern8-pattern70c.png
swfobject.js
chromelogo-pulse.swf
NETWORK:
@sethladd
sethladd / index.html
Created November 2, 2010 20:03
host html file for flash app for chrome web store packaged app
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body style="overflow:hidden">
<embed width="100%" height="99%" src="main.swf" type="application/x-shockwave-flash"></embed>
</body>
function Timer() {
this.gameTime = 0;
this.lastTick = 0;
this.maxStep = 0.05;
this.lastTimestamp = 0;
}
Timer.prototype.step = function() {
var current = Date.now();
@sethladd
sethladd / addgoogleplusonecode.js
Created June 6, 2011 04:12
Tweets +1 Chrome Extension for Google +1 Button and twitter.com
var plusOneScript = document.createElement('script');
plusOneScript.setAttribute("src", "https://apis.google.com/js/plusone.js");
plusOneScript.textContent = '{"parsetags": "explicit"}';
plusOneScript.addEventListener("load", function() {
var script = document.createElement("script");
script.textContent = "var addPlusOne = function(){gapi.plusone.go();setTimeout(addPlusOne, 1000);};setTimeout(addPlusOne, 1000);";
document.body.appendChild(script);
}, false);
document.body.appendChild(plusOneScript);
@sethladd
sethladd / post-secret-archive.rb
Created August 29, 2011 05:08
Pulling images from Post Secret
#!/usr/bin/ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'ftools'
doc = Hpricot(open("http://postsecret.blogspot.com/"))
images = []
@sethladd
sethladd / app.dart
Created February 2, 2012 05:39
Web Audio API and Dart
#import('dart:dom', prefix:'dom');
#import('dart:html');
main() {
dom.AudioContext audioContext = new dom.AudioContext();
dom.AudioBufferSourceNode source = audioContext.createBufferSource();
dom.AudioGainNode gainNode = audioContext.createGainNode();
source.connect(gainNode, 0, 0);
@sethladd
sethladd / IndexedDBSample.dart
Created February 23, 2012 01:46
Dart IndexedDB sample
#import('dart:dom', prefix:'dom');
#import('dart:html');
String VERSION = "1";
String TODOS_STORE = 'todos';
initDb(db) {
if (VERSION != db.version) {
dom.IDBVersionChangeRequest versionChange = db.setVersion(VERSION);
versionChange.addEventListener('success', (e) {
#library('lib2');
#source('lib2_helper.dart');
String lib2String = "hello from lib2";
@sethladd
sethladd / dartstagram.dart
Created April 27, 2012 16:07
Instagram API with Dart
#import('dart:html');
#import('dart:json');
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
dataReceived(MessageEvent e) {
var data = JSON.parse(e.data);
@sethladd
sethladd / Procfile
Created August 15, 2012 05:42
Dart server for Heroku
web: dart main.dart