Skip to content

Instantly share code, notes, and snippets.

View drd's full-sized avatar

Eric O'Connell drd

View GitHub Profile
@drd
drd / gist:cd591e52442a25bbb010
Created June 3, 2015 22:11
Coverage with babel/require
--------------------------------|-----------|-----------|-----------|-----------|
File | % Stmts |% Branches | % Funcs | % Lines |
--------------------------------|-----------|-----------|-----------|-----------|
src/ | 80.32 | 71.93 | 70.42 | 80.95 |
FormController.js | 76.92 | 65 | 72.22 | 72.22 |
PageComponentLoader.jsx | 33.33 | 100 | 0 | 33.33 |
Router.jsx | 89.47 | 70 | 86.67 | 89.47 |
Wish.jsx | 66.67 | 92.31 | 50 | 65.91 |
World.jsx | 91.84 | 64.29 | 92.31 | 97.83 |
config.js | 100 | 100 | 100 | 100 |
let isObject = o => toString.call(o) === '[object Object]'
let consume = i => {
let iterator = i && i.keys;
if (!iterator) return;
let arr = [];
while (res = iterator.next(), !res.isDone) arr.push(res.value);
return res;
}
@drd
drd / compiler.js
Created September 16, 2015 18:34
A caching babel compiler for require extensions, with optional preprocessor
var babel = require('babel');
var extend = require('underscore').extend;
var path = require("path");
var os = require("os");
var fs = require("fs-ext");
var merge = require('lodash').merge;
@drd
drd / plugin.js
Last active September 23, 2015 17:43
Fun with builder
const babel = require('babel');
const ast = require('./ast');
const extraction = require('./extraction');
const freeVariables = require('./free-variables');
module.exports = function({Plugin, types: t}) {
return new Plugin('transformation', {
visitor: {
@drd
drd / transform.js
Created March 4, 2016 19:34
transform jsx with babel
const babel = require('babel-core');
const transformJsx = require('babel-plugin-transform-react-jsx');
const transformObjectRestSpread = require('babel-plugin-transform-object-rest-spread');
export function transformJsx(source) {
return babel.transform(source, { plugins: [transformJsx] });
}
@drd
drd / a-tangled-miasma.md
Last active April 15, 2019 07:57
A tangled miasma of hacks that somehow manage to launch stetho

So I got annoyed at always having to reconnect to Stetho, and I figured there would be some better way to do this in Android Studio ... and maybe there is, but this is the best I've gotten so far. Putting this together in a gist was inspired by a question on reddit: https://www.reddit.com/r/androiddev/comments/7hz3xy/stetho_anyone_know_of_a_convenient_way_to/

How does this work?

  • Use Android Studio custom Run configuration to call a new gradle task :app:launchStetho before the app launches
  • The gradle task uses launchctl (docs) to start an out-of-band AppleScript automation open-stetho.applescript
  • The AppleScript waits a few seconds, then controls Chrome to open chrome://inspect and loops until the "Inspect" action is available, and then executes a click() against that DOM element

Setup

  1. Choose a location for the applescript and ensure that it's executable `chmo
@drd
drd / BETA notice.md
Last active May 27, 2019 15:05
Hilights Beta

Beta

You are invited to participate in the Hilights Beta. This means, at this point, you are one of three people, two of which are the developers of Hilights. Therefore, you know how to get in touch with us.

Privacy Policy

All information uploaded to the initial beta of Hilights is visible to the developers. We will know who you are, but we already do. <3