Skip to content

Instantly share code, notes, and snippets.


Parsha Pourkhomami parshap

View GitHub Profile
parshap / get-export-1.js
Created Feb 3, 2018
Get a module's default export from a Babel AST
View get-export-1.js
const t = require('babel-types');
const assert = require('assert');
* Is `module.exports` expression
const isModuleExportsMemberExpression = (node) => {
assert.equal(, 'module');
parshap /
Last active Jun 5, 2017
Learning JavaScript and React

Learning JavaScript and React

A guide for experienced programmers learning JavaScript and React.


Books & Reading

  • [Effective JavaScript][effectivejs] covers advanced JavaScript topics, such as concurrency and library design, in great detail.
parshap /
Last active Mar 10, 2022
Running Node Modules in React Native

Running Node Modules in React Native

How to use packages that depend on Node.js core modules in React Native.

See the [node-libs-react-native][node-libs-react-native] library as a convenience for implementing this method.

Node.js Core Modules

parshap /
Last active Jul 12, 2021
Fonts in React Native

Fonts in React Native

Default Fonts

A number of fonts are available by default based on the platform (e.g., Roboto on Android, Helvetica on iOS). See the full list here.

parshap / patch-readable-stream.js
Created Mar 12, 2017
Fix readable-stream in React Native
View patch-readable-stream.js
const glob = require('glob');
const fs = require('fs');
const path = require('path');
const ROOT_PATH = path.resolve(`${__dirname}/..`);
// Get paths to all readable-stream packages in the dependency tree
function getPackagePaths(rootPath, packageName) {
return glob.sync(`${rootPath}/**/node_modules/${packageName}`);
parshap /
Last active Oct 4, 2016
Babel 5 vs Babel 6 Difference

Babel 5 will incorrectly allow a let declration shadow an outter var declaration. See below and note the user of var _filters on line 7 by Babel 6 instead of var filters by Babel 5 (which shadows the var filters declared on line 2).

parshap / cpus.rb
Last active Aug 25, 2021
Determine number of cpu cores to use in Vagrant
View cpus.rb
# Determines how many cpus the virtual machine should be given. Uses half of
# what's available on the host with a default of 4.
def numvcpus
os_cpu_cores / 2
parshap /
Last active Jan 13, 2022
Chrome shortcut to search MDN

mdn Chrome Search Shortcut

Shortcut to perform a Google I'm Feeling Lucky search on

MDN search animation

1. Settings: Manage search engines...

Google Chrome Settings Page

parshap / stops.txt.patch
Created Jan 28, 2016
Caltrain GTFS 1/25/2006 Update
View stops.txt.patch
diff --git a/data/stops.txt b/data/stops.txt
index 4e9c24e..200a82d 100644
--- a/data/stops.txt
+++ b/data/stops.txt
@@ -1,96 +1,68 @@
-70011,70011,"San Francisco Caltrain",, 37.776390,-122.394992,1,,0,ctsf,NB
-70012,70012,"San Francisco Caltrain",, 37.776348,-122.394935,1,,0,ctsf,SB
-70021,70021,"22nd St Caltrain",, 37.757599,-122.391880,1,,0,ct22,NB
-70022,70022,"22nd St Caltrain",, 37.757583,-122.392404,1,,0,ct22,SB
parshap /
Last active Jan 5, 2016
Newrelic crash in http instrumentation

I'm seeing this crash happen in a node http service running the newrelic agent. It seems to happen in this context:

  1. An http request causes an unrecoverable error (unrelated to newrelic)
  2. req.end() and req.destroy() are called on the request that caused the error
  3. server.close() is called on the http server
  4. The newrelic agent throws the above error

I am using node v4.2.3 and newrelic agent 1.24.0.