Skip to content

Instantly share code, notes, and snippets.

View skynode's full-sized avatar
💭
I may be slow to respond.

Obi skynode

💭
I may be slow to respond.
  • Amsterdam, The Netherlands
View GitHub Profile
@skynode
skynode / introrx.md
Created February 20, 2017 13:06 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@skynode
skynode / problem.cpp
Created April 1, 2017 05:30 — forked from depp/problem.cpp
A Faster Solution
// Faster solution for:
// http://www.boyter.org/2017/03/golang-solution-faster-equivalent-java-solution/
// With threading.
// g++ -std=c++11 -Wall -Wextra -O3 -pthread
// On my computer (i5-6600K 3.50 GHz 4 cores), takes about ~220 ms after the CPU
// has warmed up, or ~110 ms if the CPU is cold (due to Turbo Boost).
// How it works: Start by generating a list of losing states -- states where the
// game can end in one turn. Generate a new list of states by running the game
@skynode
skynode / webpack.config.js
Created April 4, 2017 05:37 — forked from BinaryMuse/webpack.config.js
webpack less -> css with source maps via extracttextplugin
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var lessLoader = ExtractTextPlugin.extract(
"css?sourceMap!less?sourceMap"
);
module.exports = {
cache: true,
entry: { bundle: "./master/client/index.jsx" },
@skynode
skynode / webpack.config.dev.js
Last active April 14, 2017 01:18
Configuring Webpack 2.3.x in dev mode
import webpack from 'webpack';
import path from 'path';
import nodeExternals from 'webpack-node-externals';
export default {
devtool: "cheap-module-eval-source-map",
entry: [
//code order here is critical
"eventsource-polyfill", //for hot reloading in IE
"webpack-hot-middleware/client?reload=true", //reloads page if HMR fails
@skynode
skynode / JSXSpreadAttributes.md
Created April 20, 2017 14:27 — forked from sebmarkbage/JSXSpreadAttributes.md
JSX Spread Attributes

JSX Spread Attributes

If you know all the properties that you want to place on a component a head of time, it is easy to use JSX:

  var component = <Component foo={x} bar={y} />;

Mutating Props is Bad, mkay

@skynode
skynode / webpack-graphql.config.dev.js
Created May 7, 2017 01:53
Webpack Configuration for GraphQL
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'inline-source-map',
entry: [
'webpack-hot-middleware/client',
'./src/index'
],
@skynode
skynode / gen_secret_key.node.js
Last active May 8, 2017 12:29
Generate Strong Key in Node CLI
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"

Just some notes and references for myself.

  • In bash, you can access your C:\ drive via /mnt/c/
  • ~ = C:\Users\MLM\AppData\Local\lxss\home\mlm and is different from your Windows user directory C:\Users\MLM

How to google things

@skynode
skynode / samplerest.js
Created May 11, 2017 22:05 — forked from joshbirk/samplerest.js
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')