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 / async-play.js
Created July 17, 2014 20:44
demonstrates refactoring a bunch of node style callbacks with async
/* setup a pile of nodejs style methods that accept nodejs style callbacks (where err is the first argument and data the second)*/
var obj = {msg:'before'}
function first(obj, cb) {
console.log('first', obj.msg)
obj.msg += ' ... first'
cb(null, obj)
}
function second(obj, cb) {
@brianleroux
brianleroux / b.js
Created August 7, 2014 17:56
making battery status api async http://www.w3.org/TR/battery-status/
navigator.battery.then(function(status) {
status.charging // bool
status.chargingTime // dbl
status.dischargingTime // dbl
status.level // dbl
})
<script src=cordova.js></script>
<script>
document.addEventListener('deviceready', function() {
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
versionCode = "10"
version = "1.0.0" >
<!-- versionCode is optional and Android only -->
<name>Barcode Thing</name>
ERROR in (webpack)/~/node-libs-browser/~/buffer/index.js
Module not found: Error: Cannot resolve module 'jsx-loader' in /usr/local/lib/node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer
@ (webpack)/~/node-libs-browser/~/buffer/index.js 8:13-33
webpack: bundle is now VALID.

Keybase proof

I hereby claim:

  • I am brianleroux on github.
  • I am brianleroux (https://keybase.io/brianleroux) on keybase.
  • I have a public key whose fingerprint is 1F58 B918 EB0D B730 4FE5 D590 B8BB BC2D EC13 D8E9

To claim this, I am signing this object:

"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
__esModule: {value: true}
});
var __moduleName = "src/index";
function require(path) {
return $traceurRuntime.require("src/index", path);
@brianleroux
brianleroux / index.js
Created November 30, 2014 01:59
requirebin sketch
// hello world
var compile = require('micromark')
, src = ""
src+="# hello world! \n"
src+="- one \n"
src+="- two \n"
src+="- three \n"
import test from 'tape'
import echo from '../'
test('exists', (t) => {
t.ok(test, 'test lib correctly imported')
t.end()
})
test('echo exists', (t) => {
t.ok(echo, 'echo lib correctly imported')
{
"name": "echo-string",
"main": "dist/index.js",
"scripts": {
"compile": "6to5 --modules commonInterop src --out-file dist/index.js",
"debug": "6to5 --source-maps-inline --modules commonInterop src --out-file dist/index.js",
"test": "npm run compile && 6to5-node test/test-echo.js | tap-spec"
},