Skip to content

Instantly share code, notes, and snippets.

View nelreina's full-sized avatar
💭

Nelreina nelreina

💭
View GitHub Profile
@nelreina
nelreina / react-server.js
Last active October 1, 2016 12:37
A static server with proxy to /api. Good for serving react apps
const express = require('express');
const path = require('path');
const request = require('request');
const app = express();
const port = process.env.PORT || 4000;
const baseUrl = process.env.BASE_URL || '/registration';
const apiPort = process.env. API_PORT || 9000;
@nelreina
nelreina / boot.js
Created October 10, 2016 13:01 — forked from jdx/boot.js
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@nelreina
nelreina / .eslintrc-no-react
Last active November 27, 2016 16:23
Eslint no React
{
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
@nelreina
nelreina / hot-reload.js
Created December 3, 2016 04:30
create-react-app hot reload script goes in index.js
if (module.hot) {
module.hot.accept('./App', _ => {
const App = require('./App').default;
ReactDOM.render(
<App />,
document.getElementById('root')
);
})
}
@nelreina
nelreina / .editorconfig
Last active January 22, 2017 02:36
Editor Config
# editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@nelreina
nelreina / snippets.cson
Last active May 18, 2017 12:02
Atom snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@nelreina
nelreina / run-x-times.sql
Created August 23, 2017 19:23
run-insert-statement-x-number-of-times
create procedure insert_into_b
@numInserts int
as
begin
while @numInserts > 0
begin
insert into b (id)
select id from a
set @numInserts = @numInserts - 1
end
{
"presets": ["env"],
"plugins": ["transform-object-rest-spread"]
}
import { combineReducers } from 'redux';
export default combineReducers({
default: (state ={}, action) => state
})
module.exports = {
parser: 'babel-eslint',
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
jest: true,
},
extends: ['eslint:recommended', 'plugin:react/recommended'],