Skip to content

Instantly share code, notes, and snippets.

View brianleroux's full-sized avatar
💚
You are now aware that you are breathing

Brian LeRoux brianleroux

💚
You are now aware that you are breathing
View GitHub Profile
@brianleroux
brianleroux / phonegap-pyside.py
Created April 11, 2011 20:07
A quick, rather goofy, desktop WebKit wrapper w/ Qt/Pyside.
#! /usr/bin/env python
import sys
import os
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(True)
@brianleroux
brianleroux / v8api-tests-output.txt
Created March 19, 2011 02:25
output from v8api tests in v8monkey
Running V8 API tests...
TEST-INFO | (test_api.cpp) | Not running test_Handles (DISABLED).
TEST-INFO | (test_api.cpp) | Running test_Access.
TEST-INFO | (test_api.cpp) | Not running test_Script (DISABLED).
TEST-INFO | (test_api.cpp) | Running test_TinyInteger.
TEST-INFO | (test_api.cpp) | Running test_TinyUnsignedInteger.
TEST-INFO | (test_api.cpp) | Running test_OutOfSignedRangeUnsignedInteger.
TEST-INFO | (test_api.cpp) | Not running test_Number (DISABLED).
TEST-INFO | (test_api.cpp) | Not running test_ToNumber (DISABLED).
TEST-INFO | (test_api.cpp) | Not running test_Boolean (DISABLED).
/*
______________________________________
/ _____/\__ ___/\_ _____/\_____ \
/ \ ___ | | | __) / | \
\ \_\ \ | | | \ / | \
\______ / |____| \___ / \_______ /
\/ \/ \/
*/
@brianleroux
brianleroux / makefile
Created February 25, 2011 20:46
launch emulators
emulate:
emulator -cpu-delay 0 -no-boot-anim -cache ./cache -avd default > /dev/null 2>&1 & # put the avd's chatty ass in the background
open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
palm-emulator --start "SDK 1.4.5.465 (320x480)"
// simple animation
x$('#box').tween({ left:'100px'});
// more complicated...
x$('#box').tween({ left:'100px', duration:'0.1' });
// queue transitions w/ an array..
x$('#box').tween([{left:'100px'}, { right:'100px' }]);
// monitor wifi signal strength
navigator.system.get("Network", function(connection) {
// helper that updates the dom
function updateStatus(conn) {
var msg = "Wireless "+conn.essid+" at "+(conn.signalStrength*100)+"%";
x$('#network-status').html(msg);
}
// only watch the wifi setting
<!doctype html>
<html>
<head>
<title>isReachable Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", function() {
function reachableCallback(reachability) {
var state = reachability.code || reachability
@brianleroux
brianleroux / lawnchair-examples.js
Created January 27, 2011 06:32
examples for using lawnchair js
// create a new store
var store = new Lawnchair({adaptor:'dom', table:'people'});
// saving documents
store.save({name:'brian'});
// optionally pass a key
store.save({key:'config', settings:{color:'blue'}});
// updating a document in place is the same syntax
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>wtfwebkit</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", function() {
var foo = "<p>hello world</p>"
, master = document.body
// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
var server = https.createServer(options, function (req, res) {