Skip to content

Instantly share code, notes, and snippets.

View alunny's full-sized avatar

Andrew Lunny alunny

  • Twitter
  • San Francisco, CA
View GitHub Profile
@alunny
alunny / file-api-sample.js
Created April 14, 2010 18:41
sample usage of the phonegap file api
var writeData = function (filename, data, callback) {
var writeOutData = function () {
var fw = new FileWriter();
fw.oncomplete = callback;
fw.onerror = function () {
alert("Failed to save update");
}
fw.writeAsText("myDir/" + filename, data);
}
@alunny
alunny / index.html
Created April 13, 2012 23:37
play local audio
<html>
<h1>Playing Audio</h1>
<button onclick="playAudio('brobob.mp3')">Play Some Audio</button>
<script src="phonegap.js"></script>
<script>
function playAudio(src) {
if (device.platform == 'Android') {
src = '/android_asset/www/' + src;
}
var Hogan = require('./twitter-hogan');
var renderOptions = { asString: true, sectionTags: [{ o: '_i', c: 'i' }] };
var translateMustache = require('./translate-mustache');
function extractPartials(tmpl) {
// need eval to pull the partials out of the Hogan-generated string
/* eslint-disable no-eval */
var hoganParams = eval(`(${tmpl})`);
/* eslint-enable no-eval */
var partialNames = [];
@alunny
alunny / github.com.js
Created April 7, 2012 19:29
github++
// use with http://defunkt.io/dotjs/
$('.unread_count')
.hide()
@alunny
alunny / idealOutput.js
Last active December 12, 2016 23:22
webpack plugin question
var _ = require('i18n_library');
modules.exports = {
literalPhrase: "Hola Sean",
parameterizedPhrase: _("Hola {{person}}", { person: "Sean" })
}
@alunny
alunny / index.html
Created February 25, 2012 00:57
simple PhoneGap File API example
<html>
<body>
<form onsubmit="return saveText()">
<label for="name">Name</label><br>
<input id="name" /><br>
<label for="desc">Description</label><br>
<input id="desc" /><br>
<input type="submit" value="Save" />
spymaster: PropTypes.bool.isRequired,
double: PropTypes.string,
toggleSpymaster: PropTypes.func
}
window.addEventListener('deviceorientation', this.onDeviceOrientation)
}
$ npm install
> fsevents@1.0.9 install /Users/alunny/dev/tmp/rq/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/alunny/dev/tmp/rq/node_modules/fsevents/lib/binding/Release/node-v47-darwin-x64/fse.node" is installed via remote
require-from-twitter@0.0.1 /Users/alunny/dev/tmp/rq
├─┬ babel-cli@6.6.5
│ ├─┬ babel-polyfill@6.7.4
│ │ ├── babel-regenerator-runtime@6.5.0
if (value === 'onething') {
return correctValue;
} else {
omfg.this.should.never.happen
}
#!/bin/bash
while true
do
curl http://eztv.it | grep "href=\"\/ep\/.*\/masterchef"
if [ $? -ne 0 ]
then
echo "not found at `date`"
sleep 30
else