Skip to content

Instantly share code, notes, and snippets.

View wagenet's full-sized avatar

Peter Wagenet wagenet

View GitHub Profile
<html>
<head>
<script type="text/javascript" charset="utf-8">
window.onload = function(){
var display = document.getElementById('display'),
count;
for(count=0; count < 100000; count++) {
// 1kb
sessionStorage.setItem('i'+count, '01234567890123456789012345678901234567890123456789'+
<html>
<head>
<script type="text/javascript" charset="utf-8">
function transactionErrorCallback(error) {
console.error('Oops. Transaction error was '+error.message+' (Code '+error.code+')');
}
function transactionSuccessCallback() {
alert('Done');
}
MiniApp.Tappable = {
_tap_tapCount: null,
_tap_candidateTouch: null,
_tap_eventTimer: null,
tapWiggle: 10,
tapDelay: 200,
tapStart: function(evt){
use Rack::ShowExceptions
use Rack::CommonLogger
require 'rack/request'
require 'rack/response'
require 'open-uri'
class HeaderProxy
def call(env)
req = Rack::Request.new(env)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Morphing Power Cubes</title>
<style type="text/css" media="screen">
body {
background-color: black;
#######################
#### DOCUMENTATION ####
#######################
#
# Run as:
#
# ruby phonegap-sc.rb APP_NAME
# ruby phonegap-sc.rb APP_NAME PROJECT_PATH
# ruby phonegap-sc.rb APP_NAME PROJECT_PATH OUTPUT_PATH
#
@wagenet
wagenet / routes_hack.js
Created October 21, 2010 16:24
Fix to allow SC.routes to set a currentLocation without triggering routing.
SC.routes.currentLocationDidChange = function(){
this.set('location', this.get('currentLocation'));
};
SC.routes.addObserver('currentLocation', SC.routes, 'currentLocationDidChange');
SC.routes.locationDidChange = function(){
var location = this.get('location'),
current = this.get('currentLocation');
if (location !== current) {
this.trigger();
@wagenet
wagenet / irc-counter.rb
Created January 6, 2011 01:52
Counts the number of users in an IRC room
#!/usr/local/bin/ruby
require "socket"
irc = TCPSocket.open('irc.freenode.net', 6667)
irc.send("USER blah blah blah :blah blah\n", 0)
irc.send("NICK ChanScanBot\n", 0)
irc.send("JOIN #sproutcore\n", 0)
names = []
@wagenet
wagenet / gist:935079
Created April 21, 2011 17:46
Git Lines of Code
#!/usr/bin/env ruby
# encoding: UTF-8
require 'optparse'
class File
def self.binary?(name)
fstat = stat(name)
return false unless fstat.file?
C:/Ruby192/bin/ruby.exe extconf.rb
Compiling The Ruby Racer...
checking for v8.h in C:/Ruby192/lib/ruby/gems/1.9.1/gems/libv8-3.4.4-x86-mingw32/lib/libv8/v8/include... yes
checking for main() in -lpthread... no
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_v8'" > v8-i386-mingw32.def
g++ -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -IC:/Ruby192/lib/ruby/gems/1.9.1/gems/libv8-3.4.4-x86-mingw32/lib/libv8/v8/include -Wall -g -rdynamic -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o rr.o -c rr.cpp
rr.cpp: In function 'VALUE rr_define_finalizer(VALUE, void*, VALUE)':