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 / 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

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')
var Sequelize = require('sequelize')
var db = new Sequelize('mydb', null, null, {
dialect: 'postgres'
})
var Post = db.define('post', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
@skynode
skynode / Associations.js
Created May 17, 2017 22:05 — forked from vsnikkil/Associations.js
Sequelize snippets
import User from './User'
import Session from './Session'
/* Associations */
User.hasMany(Session)
/* Hooks */
User.afterDestroy(async (user, options) => {
await Session.destroy({
where: { userId: user.id },
@skynode
skynode / BookUser.js
Created May 17, 2017 22:07 — forked from ericpkatz/BookUser.js
Sequelize Review
var expect = require('chai').expect;
var Sequelize = require('sequelize');
var db = new Sequelize('postgres://localhost/amazon_db');
var User = db.define('user', {
name: {
type: Sequelize.STRING,
allowNull: false
},
foo: {