Skip to content

Instantly share code, notes, and snippets.

View openhoat's full-sized avatar

Olivier Penhoat openhoat

  • Bordeaux France
View GitHub Profile

Netlify + React Demo

Deploy a react app with serverless function in minutes (online demo):

  1. Create a basic react app

    $ npx create-react-app netlify-react-demo --use-npm
'use strict';
const path = require('path');
const fs = require('fs');
const _ = require('lodash');
const hat = require('hat');
const homeDir = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
const src = path.join(homeDir, 'actifs.res');
const dest1 = path.join(homeDir, 'actifs.res.out1');
const dest2 = path.join(homeDir, 'actifs.res.out2');
@openhoat
openhoat / centos-node-app-initd-service
Last active January 17, 2016 11:50
CentOS Initd startup script for nodejs app
#!/bin/sh
# -*-Shell-script-*-
#
# chkconfig: 35 99 99
# description: initd startup script for nodejs app <%= name %>
#
. /etc/rc.d/init.d/functions
@openhoat
openhoat / array-of-func-executor.js
Created December 24, 2015 10:02
Execute an array of function in one line
var funcs = [
function hello() {
console.log('hello');
},
function world() {
console.log('world');
},
function foo() {
console.log('foo');
},
@openhoat
openhoat / sortjson
Created October 23, 2015 09:57
Sort JSON by key
#!/usr/bin/env node
'use strict';
// Read stdin JSON, sort keys and pretty format to stdout
var stdin = process.stdin,
stdout = process.stdout,
chunks = [];
var GoogleSpreadsheet = require('google-spreadsheet')
, Profess = require('profess')
, config, profess, spreadsheet, errorHandller;
config = {
gdocKey: process.argv[2] || '0AilC0U4Eb0tjdGEwR1RDTlRrbnVHbUVBWjBSVHk5OVE', // Sample doc https://docs.google.com/a/octo.com/spreadsheet/ccc?key=0AilC0U4Eb0tjdGEwR1RDTlRrbnVHbUVBWjBSVHk5OVE&usp=drive_web#gid=0
googleLogin: process.argv[3],
googlePwd: process.argv[4],
worksheetIndex: 0
};