Skip to content

Instantly share code, notes, and snippets.

View paularmstrong's full-sized avatar
🐈‍⬛
Codes with cats

Paul Armstrong paularmstrong

🐈‍⬛
Codes with cats
View GitHub Profile
const HeartIcon = (props = {}) => (
<svg {...props} viewBox='0 0 ${width} ${height}'>
<g><path d='M38.723 12c-7.187 0-11.16 7.306-11.723 8.131C26.437 19.306 22.504 12 15.277 12 8.791 12 3.533 18.163 3.533 24.647 3.533 39.964 21.891 55.907 27 56c5.109-.093 23.467-16.036 23.467-31.353C50.467 18.163 45.209 12 38.723 12z'></path></g>
</svg>
);
const plugins = [
// extract vendor and webpack's module manifest
new webpack.optimize.CommonsChunkPlugin({
names: [ 'vendor', 'manifest' ],
minChunks: Infinity
}),
// extract common modules from all the chunks (requires no 'name' property)
new webpack.optimize.CommonsChunkPlugin({
async: true,
children: true,
import hoistStatics from 'hoist-non-react-statics';
import React from 'react';
/**
* Allows two animation frames to complete to allow other components to update
* and re-render before mounting and rendering an expensive `WrappedComponent`.
*/
export default function deferComponentRender(WrappedComponent) {
class DeferredRenderWrapper extends React.Component {
constructor(props, context) {
@paularmstrong
paularmstrong / memorySizeOfObject.js
Created March 16, 2017 17:03
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@paularmstrong
paularmstrong / memorySizeOfObject.js
Created March 16, 2017 17:03
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
const FetchStatus = {
FAILED: 'failed',
LOADED: 'loaded',
LOADING: 'loading',
NONE: 'none'
};
class LoadingRenderer extends React.Component {
static propTypes = {
fetchStatus: React.PropTypes.oneOf(Object.values(FetchStatus)).isRequired,

Keybase proof

I hereby claim:

  • I am paularmstrong on github.
  • I am paularmstrong (https://keybase.io/paularmstrong) on keybase.
  • I have a public key ASBFEf8k-OMRv7mD5wCCWTGMs7hwhdni7EO1LxPII3dnPwo

To claim this, I am signing this object:

const state = {
timelines: {
home: {
tweets: [
'123',
'456',
'789',
'012'
]
}

Convert Mocha and Chai to Jest

$ jscodeshift <path> -t assert-to-expect.js
$ jscodeshift <path> -t mocha-to-jest.js
@paularmstrong
paularmstrong / ignore.txt
Last active August 26, 2016 00:52 — forked from dapperfu/pia.sh
.Spotlight*
.Trash*
.AppleDouble*
Thumbs.db
.DocumentRevisions*
.AppleDB*
.AppleDesktop*
.apdisk*
.TemporaryItems*