Skip to content

Instantly share code, notes, and snippets.

View ide's full-sized avatar
📈
My life is a hackathon

James Ide ide

📈
My life is a hackathon
View GitHub Profile
@ide
ide / error.js
Last active November 17, 2020 18:56
Custom error subclasses in JavaScript (2020)
class CustomError extends Error {}
CustomError.prototype.name = CustomError.name;
@ide
ide / fix-mac-audio.sh
Created July 10, 2020 02:02
Fix audio by restarting coreaudiod on macOS
# macOS regularly enters a bad state where audio doesn't play at all or the sound levels are miscalibrated and the
# speakers are quiet even at high volume settings. Various sites suggest different approaches, some of which worked for me
# and some which didn't.
#
# Restarting the audio daemon is ideal since you don't need to restart your computer and fortunately it has worked in
# several scenarios for me.
# This works for me the most when my audio doesn't work on video calls or when my sound levels are miscalibrated
sudo launchctl stop com.apple.audio.coreaudiod
sudo launchctl start com.apple.audio.coreaudiod
@ide
ide / circleci.patch
Created September 19, 2017 23:52
Patch for React Native Android CI
commit 99e5c8f1b47abe252039335a6bcc40708b2a25ea
Author: James Ide <ide@jameside.com>
Date: Tue Sep 19 15:45:36 2017 -0700
[ci] Don't set /dev/shm as the temp dir in CircleCI
CircleCI doesn't let us map objects under /dev/shm from within the Docker container so another directory instead when running in CircleCI. This change shouldn't impact FB's internal CI.
diff --git a/ReactAndroid/DEFS b/ReactAndroid/DEFS
index f1754c8e3..9c268a4cd 100644
@ide
ide / proposal.md
Last active October 10, 2017 00:34
Monorepo workspaces

Yarn workspaces (as I understand them) use the root of the Lerna-style repository to install node_modules. Lerna-style repos tend to contain libraries rather than apps, though.

In a monorepo with multiple apps, we want each app to have its own node_modules directory. This is so that each app's node_modules directory contains only that app's dependencies, which can lead to better deduping for that app. Also if an app has postinstall scripts that modify node_modules, those scripts should modify only that app's node_modules.

@ide
ide / vm-benchmark.js
Created August 13, 2017 07:06
Node VM context creation benchmark
const vm = require('vm');
const batchSize = 100;
const limit = batchSize * 30;
let contexts = new Array(limit);
for (let i = 0; i < limit / batchSize; i++) {
// Compute the average time for each batch
let start = Date.now();
for (let j = 0; j < batchSize; j++) {
@ide
ide / keybase.md
Created June 17, 2017 21:11
keybase.md

Keybase proof

I hereby claim:

  • I am ide on github.
  • I am ide (https://keybase.io/ide) on keybase.
  • I have a public key ASAdOyeVcBhKU9rNeh3URMFoCh35vQWH5fnDi9HODfQ7swo

To claim this, I am signing this object:

@ide
ide / 1. Original Source .js
Last active September 2, 2016 20:04
Comparing Babel + Uglify with Babel + Babili (with pretty-printing, September 2016)
async function getTemperatureForecastAsync() {
let response = await fetch('/forecast.json');
let result = await response.json();
return result.temperature;
}
@ide
ide / Universe
Last active October 10, 2017 00:34
View of the Expo Universe
.
├── README.md
├── experiences # Experiences built with Expo
│   ├── ...
│   ├── floatyplane
│   ├── list
│   └── ui-explorer
├── ci # Scripts that automate testing and building
│   └── ...
├── dev # Tools for developers using or integrating w/Expo
@ide
ide / Profile.js
Created January 16, 2016 03:15
Example React component file
/**
* @providesModule Profile
*/
'use strict';
import React, {
Image,
PropTypes,
StyleSheet,
Text,
@ide
ide / ChildStyler.js
Created January 14, 2016 23:48
Applying styles to children
import React, {
StyleSheet,
} from 'react-native';
export default class ChildStyler extends React.Component {
render() {
return (
<View {...this.props}>
{React.Children.map(this.props.children, child => React.cloneElement(child, {
style: [child.props.style, styles.customChildStyle],