Skip to content

Instantly share code, notes, and snippets.

@turadg
turadg / removeUnusedModules.sh
Created December 8, 2017 02:54
Find in webpack builds modules that are never imported
View removeUnusedModules.sh
#!/bin/bash
echo "Testing prod build for modules in src that aren't ever imported."
echo
echo "NOTE: Any dev-only imports will appear to be unused."
USED_LIST_PATH=usedModules.txt
STATS_PATH=public/assets/stats.json
@turadg
turadg / silence-React-15-deprecations.js
Last active April 13, 2018 18:46
Jest setup file to stop React 15.5 createClass / PropTypes deprecation warnings
View silence-React-15-deprecations.js
import React from 'react';
/**
* Since React v15.5, there's a warning printed if you access `React.createClass` or `React.PropTypes`
* https://reactjs.org/blog/2017/04/07/react-v15.5.0.html#new-deprecation-warnings
*
* `import * as React from 'react'` is required by Flowtype https://flow.org/en/docs/react/types/ ,
* but the * causes both those deprecated getters to be called.
* This is particularly annoying in Jest since every test prints two useless warnings.
*
@turadg
turadg / generateFlowModuleNameMappers.js
Last active June 20, 2018 06:28
Helper to create .flowconfig module name mapper
View generateFlowModuleNameMappers.js
#!/usr/bin/env node
/**
* Flowtype understands Node (or Haste) imports but not Webpack.
*
* Many codebases have webpack set up like:
* src/foo.js
* src/components/Bar.jsx
*
* And then import them like `require('foo')` or `require/components/Bar.jsx`
*
@turadg
turadg / swaggerTable.js
Created January 3, 2017 22:50
Generate a tab delimited table of endpoints on a Swagger-described API
View swaggerTable.js
#!/usr/bin/env node
/*
For Swagger 1.2 docs format.
Hardcode the base path in the urlFor() function.
Assumes Node 6+.
*/
View retroflow.sh
#!/bin/bash
#
# Retroflow
#
# This makes it easier to retrofit Flow type checking onto your existing code.
#
# Given a path argument, it finds all the js/jsx files under that path that
# don't have the Flow (flowtype.org) preamble. It then adds it and runs the
# Flow check. If anything fails, it removes it again.
#
View codecov debug.sh
#!/bin/bash
# fork of https://codecov.io/bash
set -e +o pipefail
VERSION="0db33a1"
url="https://codecov.io"
url_o=""
verbose="0"
View keybase.md

Keybase proof

I hereby claim:

  • I am turadg on github.
  • I am turadg (https://keybase.io/turadg) on keybase.
  • I have a public key whose fingerprint is 1AAF D87D B5DB 6B87 29A5 7646 0249 C9F5 1B7F 02C2

To claim this, I am signing this object:

View navigateActionExample.js
/**
* The router runs this navigate action once a new route is resolved.
* This returns a promise that must be satisfied before the render
* starts. The promise consists of all actions that each handler
* in the route declares that it needs before navigating.
*
* WHEN we upgrade react-router to 1.0, we should revisit this design
* https://github.com/rackt/react-router/pull/1158
*
* @return {Promise} to satisfy all the dependencies of the route
@turadg
turadg / README.md
Created April 1, 2015 16:01
Retracked draft
View README.md

Retracked wraps your event recording system in an API optimized for React components.

Usage

Setup

Somewhere early in execution:

# set the recording function
retracked.setup(myTrackingSystem.push);
@turadg
turadg / designer.html
Created July 28, 2014 11:26
designer
View designer.html
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<polymer-element name="my-element">
<template>