Skip to content

Instantly share code, notes, and snippets.

one colon vs two
wrap, wrapper, inner, container
ordering properties
https://codepen.io/spencerkingman/full/WOROqQ/
https://codepen.io/spencerkingman/full/MopGvp/
/**
CRA
- comes with fetch
- node-path
-nmaes https://github.com/airbnb/javascript#naming--filename-matches-export
* use core building blocks (<Button />, etc)
* background: url(./niche-logo-stacked.svg); // Webpack finds al relative module refs and replaces them with final paths from compiled bundle
* babel-present-env
* breakpoint
/**
https://developers.google.com/speed/docs/insights/PrioritizeVisibleContent
> Structure your page so the initial response from your server sends the data necessary to render the critical part
of the page immediately and defer the rest. This may mean that you must split your CSS into two parts:
- an inline part that is responsible for styling the ATF portion of the content,
- and the part that can be deferred.
Enter isomorphic-style-loader
// --- open questions --
// type systems? typescript, flow
// ex:
function add(left: number, right: number): number {
return left + right;
}
// typescript:
// - provides static typing through type annotations to enable type checking at compile time
// https://github.com/tc39/proposal-dynamic-import
// http://2ality.com/2017/01/import-operator.html#loading-code-on-demand
/**
CURRENT STATE
- top-level, not conditional, not able to be used in event handler,
- not dynamic due, fixed module specifier (./dir/someModule)
**/
import * as someModule from './dir/someModule.js'
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "yaml"
# Load our default config file, 'config/default.yaml'
CONF = YAML.load(File.open("config/default.yaml", File::RDONLY).read)
# Next, load local overrides from 'config/local.yaml'
# If it doesn't exist, no worries. We'll just use the defaults
/* eslint-disable class-methods-use-this */
import React from 'react'
import { connectToStores } from 'fluxible-addons-react'
/**
* In our unit test suite, it becomes really cumbersome to
* test around the component wrapper that gets instantiated
* through the `connectToStores` call. This method just lets
* us avoid this wrapper for direct access to the component
import React from 'react'
import { withDependencies } from '../utils/env-utils'
import { isInBackpack } from '../utils/backpack-utils-utils'
const BackpackTester = ({ thing }, { _ }) => (
const isThingInBackpack = _.isInBackpack(thing)
return (
<div>
Is thing in backpack? { isThingInBackpack }
@kimniche
kimniche / pre-commit
Created December 14, 2016 21:33
Error if your commit includes any `console` mentions
#!/bin/bash
LOG="[pre-commit]"
console=`grep -n console $(git diff --name-only --cached) -H --color`
if [ -z "$console" ]; then
tput setaf 2; echo "$LOG no \`console\` left in commit"
tput sgr0
exit 0