Skip to content

Instantly share code, notes, and snippets.

View autonome's full-sized avatar

Dietrich Ayala autonome

View GitHub Profile
@autonome
autonome / gist:5121490
Last active December 14, 2015 17:19
bookmarklet to tip Github accounts using Gittip.com
Drag this link to your bookmarks toolbar. You can click it when on a Github account page to quickly tip someone when you use their code or like their project!
<a href="javascript:window.location = 'https://www.gittip.com/on/github/' + document.URL.split('/').pop()">Gittip!</a>
@autonome
autonome / gist:6101578
Last active December 20, 2015 08:39
firebase+persona example
<button id="signin">Sign in</button>
<script type='text/javascript' src='https://cdn.firebase.com/v0/firebase.js'></script>
<script type='text/javascript' src='https://cdn.firebase.com/v0/firebase-simple-login.js'></script>
<script type='text/javascript' src='https://login.persona.org/include.js'></script>
<script type='text/javascript'>
var chatRef = new Firebase('https://SampleChat.firebaseIO-demo.com'),
signedIn = false
function installAppFromManifestObj(obj) {
//const {Cc, Ci, Cu, Cm} = require('chrome')
var Cu = Components.utils
Cu.import("resource://gre/modules/WebappsInstaller.jsm")
var installParam = {
app: {
manifest : obj,
origin: obj.url
}
}
@autonome
autonome / gist:8262161
Created January 4, 2014 23:23
my configuration stuff for Nexus 4 + Firefox OS latest (mozilla-central + gaia/master
# cleanup
rm -rf objdir-gecko && rm -rf out
# .userconfig
export BRANCH=master
export HIDPI=1
export NOFTU=1
# configure
<div id="myElement">asdfa</div>
<script>
var element = document.querySelector('#myElement')
element.addEventListener('dblclick', makeEditable, false)
function makeEditable(e) {
var editable = e.target,
input = document.createElement('input')
input.value = editable.textContent
Firefox OS News Reader
Software Requirements Document
(Draft 1, May 2014)
Christopher Behrens, Randal Holmes, Nhan Huynh,
Michael Kuvelas, Mike Messuri-Zhang, Jeremy Sample, Josh Willhite
if (navigator.mozSetMessageHandler) {
function NFCActivityHandler(activity) {
var text = activity.source.data.text;
if (!text) {
updateText('No text record')
}
else if (text.indexOf('bcm:') === 0) {
var email = text.substr(4)
registerRider(email)
updateText('Registered ' + email)
@autonome
autonome / gist:179afc6f9515a5008cb1
Created October 19, 2014 19:09
Query Selector Helpers
/*
Quick and easy conversion of nodelist to array.
You're on your own for error handling - invalid selectors throw an exception!
Example:
qsa['.fooble'].forEach(function(node) {
// do stuff
/chrome.manifest:
component {a5d89cee-85f4-44ad-b8eb-39ad39170823} components/helloworldapi.js
contract @mozilla.org/helloworld;1 {a5d89cee-85f4-44ad-b8eb-39ad39170823}
category JavaScript-navigator-property helloworld @mozilla.org/helloworld;1
/components/helloworldapi.js:
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
@autonome
autonome / webspeechwrapper.js
Last active August 29, 2015 14:14
Web Speech API utility
function say(phrase) {
speechSynthesis.speak(new SpeechSynthesisUtterance(phrase));
}
// words: array of strings
function addSpeech(words) {
var speechrecognitionlist = new SpeechGrammarList();
speechrecognitionlist.addFromString(
"#JSGF V1.0; grammar test; public <simple> = " +
words.join(' | ') + ' ;', 1);