{ | |
// http://eslint.org/docs/rules/ | |
"ecmaFeatures": { | |
"binaryLiterals": false, // enable binary literals | |
"blockBindings": false, // enable let and const (aka block bindings) | |
"defaultParams": false, // enable default function parameters | |
"forOf": false, // enable for-of loops | |
"generators": false, // enable generators | |
"objectLiteralComputedProperties": false, // enable computed object literal property names |
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address | |
function getClientIp(req) { | |
var ipAddress; | |
// The request may be forwarded from local web server. | |
var forwardedIpsStr = req.header('x-forwarded-for'); | |
if (forwardedIpsStr) { | |
// 'x-forwarded-for' header may return multiple IP addresses in | |
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the | |
// the first one | |
var forwardedIps = forwardedIpsStr.split(','); |
const Promise = require('bluebird'); | |
const React = require('react'); | |
const superagent = require('superagent'); | |
const assign = require('lodash/object/assign'); | |
const isArray = require('lodash/lang/isArray'); | |
const isFunction = require('lodash/lang/isFunction'); | |
const isObject = require('lodash/lang/isArray'); | |
const isString = require('lodash/lang/isString'); | |
const log = require('debug')('component:await'); |
//@flow | |
import { createStore, applyMiddleware } from 'redux'; | |
import storage from 'redux-persist/lib/storage' | |
import { composeWithDevTools } from 'redux-devtools-extension'; | |
import { persistStore, persistReducer } from 'redux-persist'; | |
import thunk from 'redux-thunk'; | |
import reducer from 'reducers'; | |
import { createOffline } from '@redux-offline/redux-offline'; | |
import offlineConfig from '@redux-offline/redux-offline/lib/defaults/index'; |
definitions: | |
caches: | |
poetry-path: /root/.poetry | |
poetry-venv: /root/.cache/pypoetry/virtualenvs | |
steps: | |
- step: &step-37 | |
image: python:3.7 | |
caches: | |
- poetry-path |
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
Thanks to React hooks you have now happily turned all your classes into functional components.
Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.
There is just no functional equivalent for componentDidCatch
and deriveStateFromError
yet.
// scraped from https://mariadb.com/kb/en/mariadb/documentation/sql-language-structure/mariadb-error-codes/ | |
// | |
module.exports = [ | |
[ | |
"1000", | |
"HY000", | |
"ER_HASHCHK", | |
"hashchk" | |
], | |
[ |
Advice: if you have style guide / policy, apply it automatically ( in the editor or git hook ) https://github.com/jshint/fixmyjs
Collection of (mostly) JS styles (pick one you like or write another one if none fits you)
- list of lists: http://www.jstherightway.org/