Skip to content

Instantly share code, notes, and snippets.

View aquiseb's full-sized avatar

Sébastien aquiseb

View GitHub Profile
@aquiseb
aquiseb / node-minimal-hot-reload.js
Last active January 30, 2019 16:49
Nodejs minimal hot reload function
const cluster = require('cluster');
const chokidar = require('chokidar');
function start() {
// do something here
console.log('START >>');
}
function hot(start, files) {
if (typeof files == 'string') files = [files];
@aquiseb
aquiseb / all-html-tags.json
Last active January 24, 2019 13:56
List of all html tags in plain text and json
["!DOCTYPE",
"a",
"abbr",
"acronym",
"address",
"applet",
"area",
"article",
"aside",
"audio",
@aquiseb
aquiseb / app.js
Created December 28, 2018 12:35 — forked from lufzle/app.js
Node.js hot-reloading using Cluster
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.status(200)
.contentType('application/json')
.json({ hello: 'world' })
})
type Props = { [key: string]: object | string };
// Classbase just declares any class that must have a display name and are constructible
interface ClassBase {
displayName: string;
// new?(): Props;
}
// Declare UserHandler interface
interface UserHandler extends ClassBase {
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void learnTypesAndSize() {
/** TYPES */
cout << "\n:::: TYPES ::::" << endl;
@aquiseb
aquiseb / readme.md
Last active February 28, 2024 00:03

Typescript Cheatsheet

A minimalist typescript cheatsheet to get started quickly

// Install typescript
npm install -g concurrently lite-server typescript

// Run the .ts
tsc typescript-cheatsheet --watch
Start a nodejs command forever

forever start -c "npm start" ./

Show forever processes

forever list

Stop one forever process

sudo kill -9 PID

Stop all forever processes
// PARENT
const query = graphql.experimental`
query MyRootComponentQuery($employeeId: String!, $includeOvertime: Boolean) {
employee(id: $employeeId) {
fullName
...MyFragmentComponent_employee @arguments(includeOvertime: $includeOvertime)
}
}
`
@aquiseb
aquiseb / Go_Friendly-configs-1_start.sh
Last active May 1, 2018 07:12
Go Friendly Configs
#! /bin/bash
# ------------------------------------------------------------
# Downloads required packages
# ------------------------------------------------------------
# Realize is a Golang Task Runner performing live reloading
if [ ! -f $GOPATH/bin/realize ] && [ ! -d $GOPATH/src/github.com/oxequa/realize ]; then
echo "Realize not found. Downloading it for you..."
import React from 'react';
const initialData = "hello from initial data"
function iterateOverChildren(children) {
return React.Children.map(children, child => {
if (!React.isValidElement(child)) {
return child;
}