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 / stopgap.js
Created October 6, 2011 18:17
alunny's stopgap in gist form
(function () {
function deviceready() {
var e = document.createEvent('Events')
e.initEvent('deviceready')
document.dispatchEvent(e)
}
if (typeof PhoneGap != 'undefined') {
navigator.camera = {}
navigator.camera.getPicture = function() {
alert('sorry, camera not supported in the browser: yet!')
@brianleroux
brianleroux / whatever.txt
Created September 16, 2011 14:21
JS MVC Frameworks Compared by Size
238B angularjs
170B backbone
204B javascriptmvc
204B knockoutjs
340B sammyjs
238B spine
374B sproutcore
204B yuilibrary
@brianleroux
brianleroux / index.html
Created September 15, 2011 13:54
ghetto-photoshare app logic
<!DOCTYPE html>
<html>
<body>
<script src="phonegap-1.0.0.js"></script>
<script>
function uploadPhoto(imageURI) {
function win(r) {
@brianleroux
brianleroux / full-device-width-height.html
Created September 12, 2011 16:32
quick example of getting 100% w/h
<!DOCTYPE HTML>
<html>
<head>
<meta name=viewport content=width=device-width, user-scalable=no>
<style>
body {
margin:0;
padding:0;
background:blue;
}
@brianleroux
brianleroux / npm-picnic.md
Created September 6, 2011 19:11
nodeconf camp discussion about npm things

npm hangout

wherein we hang out and talk about npm stuff and occasionally mock ruby

using npm for building node extensions

  • npm catches missing node-waf and/or node-waf deps like python - charlie
@brianleroux
brianleroux / xhr-post.js
Created August 25, 2011 17:06
quick xhr post example
// USAGE
// post('http://example.com', {name:'brian'}, console.log)
var post = function(url, params, cb) {
var x = new XMLHttpRequest()
, p = ''
x.onreadystatechange = function() {
if (x.readyState === 4)
cb.call(this, x.status)
}
@brianleroux
brianleroux / fake-deviceready.js
Created August 5, 2011 19:58
put this in a script at the bottom of your html to fake a phonegap deviceready event
if (!PhoneGap)
document.dispatchEvent(document.createEvent('Events').initEvent('deviceready'))
@brianleroux
brianleroux / server.js
Created July 28, 2011 16:53
pls make this better
// seems the coffee method run is the way to go but I was using it wrong (I think)
require('fs').readFile('app.coffee', function(err, code) {
// anyhow, this works but is certianly not ideal
eval(require('coffee-script').compile(code.toString('utf8')))
})
// also: I do *not* want a compile ceremony leaving .js detritus all over my project if possible!
@brianleroux
brianleroux / config.js
Created May 16, 2011 12:40
ExpressJS so simple it should work but of course it does not.
require.paths.unshift('./node_modules')
var express = require('express')
, app = express.createServer()
, store = require('connect-redis')
app.configure(function(){
app.use(express.methodOverride())
app.use(express.bodyParser())
@brianleroux
brianleroux / android-highest-target.sh
Created April 27, 2011 20:07
get the highest target from android
# the horror, the utility
android list targets | grep 'id: ' | sed 's/id: \([0-9]\).*/\1/g' | tail -1