Skip to content

Instantly share code, notes, and snippets.

View indexzero's full-sized avatar
🌎
Always bet on Open Source

Charlie Robbins indexzero

🌎
Always bet on Open Source
View GitHub Profile
@indexzero
indexzero / readme-outline.md
Created November 14, 2011 08:26
A quick outline of a README.md

README.md Outline

  • Header and a Brief description (should match package.json)
  • Example (if applicable)
  • Motivation (if applicable)
  • API Documentation: This will likely vary considerably from library to library.
  • Installation
  • Tests
  • Contributors
  • License
@indexzero
indexzero / round-robin-proxy.js
Created March 14, 2011 20:15
A simple example of how to do round-robin proxying for a single domain
var httpProxy = require('http-proxy');
//
// Addresses to use in the round robin proxy
//
var addresses = [
{
host: 'ws1.0.0.0',
port: 80
},
@indexzero
indexzero / install.sh
Created August 20, 2011 16:25
The simplest possible package.json for installing things with npm.
mkdir sandbox
curl https://gist.github.com/gists/1159290/download -o node-sandbox.tgz
tar zxvf node-sandbox.tgz
mv gist1159290*/* sandbox/
rm -rf gist1159290*
cd sandbox
@indexzero
indexzero / gather.js
Last active August 15, 2019 16:06
Basic puppeteer CSS coverage. Adapted from https://stackoverflow.com/a/48452214
const puppeteer = require('puppeteer');
const util = require('util');
const fs = require("fs");
const path = require('path');
(async (url) => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.coverage.startCSSCoverage();
await page.goto(url);
@indexzero
indexzero / output.log
Created May 30, 2019 18:33
Execution semantics for async functions not invoked with await
executeMultiple | start
executeMultiple | end
executeMultipleAsync | start
executeMultipleAsync | end
executeMultiple | execute1
executeMultipleAsync | execute1
executeMultiple | execute2
executeMultipleAsync | execute2
executeMultipleAsync | callback
@indexzero
indexzero / PushNotificationiOS.md
Last active May 10, 2019 01:20
Draft proposal for Push Notifications and PushNotificationiOS

Proposal for Push Notifications and PushNotificationiOS

@salakar, @ashoat, @indexzero, @swaagie, @3rdeden, and @msluther met today to discuss this. This is the draft proposal written up during that meeting. We plan to iterate on this over the next week and then post it into a new proposal in react-native-community.

A recording of that meeting can be found below in MP4 format.

Prior art

  • Push Notification packages
  • react-native-push-notification
@indexzero
indexzero / index.html
Created April 17, 2019 08:00 — forked from jjgonecrypto/index.html
es6 proxy #jsbench #jsperf (http://jsbench.github.io/#531652a2edfa806a5014558bafe6eb0e) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>es6 proxy #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@indexzero
indexzero / output.log
Created April 17, 2019 06:33
Promise.all proof by doing
Start | 1 | foo
Start | 2 | bar
Start | 3 | bazz
End | 2 | bar
End | 3 | bazz
End | 1 | foo
[ 'foo', 'bar', 'bazz' ]
@indexzero
indexzero / jscs-to-eslint.md
Last active April 8, 2019 07:58
Replacing JSCS with ESlint

ESLint support for autofix has improved considerably in the last 12 months. With jscs being formally deprecated for some time now and the notable problems with JSX autofix interop the time has come to drop it. Below you will find an as close as possible mapping of jscs options to eslint.

This is not a complete file including all the various exceptions and options that eslint needs to mimic the current jscs behavior, but it should illustrate that it is possible and worth pursuing.

{
  "esnext": true,
  "plugins": ["jscs-jsx-rules"],
  "requireCurlyBraces": ["else","for","while","do","try","catch","switch"],
  "requireSpaceBeforeKeywords": ["else","while","catch"],  // keyword-spacing
@indexzero
indexzero / proxy-rewriting.js
Created February 19, 2014 06:44
URL to host rewrite proxying with node-http-proxy
var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxy();
var fulltld = 'my-own-domain.com';
var options = {
'/first-target': 'first-target',
'/second-target': 'second-target'
}