Skip to content

Instantly share code, notes, and snippets.

View igorjs's full-sized avatar
🦝
Building Raccoon Lang

igor.js igorjs

🦝
Building Raccoon Lang
View GitHub Profile
@igorjs
igorjs / .eslintrc
Created July 17, 2017 15:21 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// 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
@igorjs
igorjs / ip.js
Created June 6, 2019 05:46 — forked from qiao/ip.js
Node.js get client IP address
// 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(',');
@igorjs
igorjs / Await.js
Created September 14, 2019 17:55 — forked from evanrs/Await.js
React WaitOn component
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');
@igorjs
igorjs / configureStore.js
Created June 15, 2020 06:02 — forked from jarvisluong/configureStore.js
Custom redux persist version for redux-offline
//@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';
@igorjs
igorjs / README-Couchbase-Docker.adoc
Created June 15, 2020 06:34 — forked from HodGreeley/README-Couchbase-Docker.adoc
Docker Scripts to Simplify Setup with Couchbase

Docker Scripts to Simplify Setup with Couchbase

@igorjs
igorjs / bitbucket-pipelines.yml
Created August 22, 2020 11:43 — forked from Gr1N/bitbucket-pipelines.yml
Why Drone CI can be interesting for you? Example of Bitbucket Pipelines configuration using YAML anchors and aliases
definitions:
caches:
poetry-path: /root/.poetry
poetry-venv: /root/.cache/pypoetry/virtualenvs
steps:
- step: &step-37
image: python:3.7
caches:
- poetry-path

What I Wish I'd Known About Equity Before Joining A Unicorn

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

@igorjs
igorjs / _readme.md
Created October 12, 2020 23:52 — forked from andywer/_readme.md
React - Functional error boundaries

React - Functional error boundaries

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.

Proposed solution

// scraped from https://mariadb.com/kb/en/mariadb/documentation/sql-language-structure/mariadb-error-codes/
//
module.exports = [
[
"1000",
"HY000",
"ER_HASHCHK",
"hashchk"
],
[
@igorjs
igorjs / README.md
Created November 25, 2020 06:50 — forked from sidorares/README.md
node.js conventions and best practices

Node.JS best practices and conventions

This is not about JS style

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)