Skip to content

Instantly share code, notes, and snippets.

View andrewimm's full-sized avatar

Andrew Imm andrewimm

  • Facebook, Oculus, Parse
  • California
View GitHub Profile
@andrewimm
andrewimm / createPolyComponent.js
Created November 30, 2017 21:53
Google Poly API + React VR
import React from 'react';
import {Model} from 'react-vr';
function getFormat(formats, format) {
for (let i = 0; i < formats.length; i++) {
if (formats[i].formatType === format) {
return formats[i];
}
}
}
@andrewimm
andrewimm / bin.js
Created May 15, 2017 18:14
yarn create package, if your CLI requires intercepting the arguments
#!/usr/bin/env node
'use strict';
const path = require('path');
const child_process = require('child_process');
const bin = path.resolve(__dirname, 'node_modules', '.bin', 'your-app-cli');
const args = process.argv.slice(2);
@andrewimm
andrewimm / package.json
Created May 15, 2017 18:12
Simple yarn create, if your CLI just takes a stream of arguments
{
"name": "create-your-app",
"bin": "./node_modules/.bin/your-app-cli",
"dependencies": {
"your-app-cli": "*"
}
}
@andrewimm
andrewimm / index.js
Created April 1, 2016 22:55
FB Send plugin in React
import React from 'react';
import ReactDOM from 'react-dom';
let fbInjected = false;
let fbLoaded = !!window.FB;
let fbCallbacks = [];
function onFbLoad() {
fbLoaded = true;
fbCallbacks.forEach((cb) => {
@andrewimm
andrewimm / gist:3006678
Created June 27, 2012 20:27
Playing JS Golf with PubSub. 171 bytes gzipped
function ps(d){c={};d.pub=function(a,b){for(var i=c[a].length;i;)c[a][--i].apply(this,b)};d.sub=function(a,b){c[a]?c[a].push(b):c[a]=[b]};d.unsub=function(a,b){c[a]=(c[a]||[]).filter(function(i){return i!==b})}}