Skip to content

Instantly share code, notes, and snippets.

Preparing my next talk

Vincent vincentdesmares

Preparing my next talk
View GitHub Profile
View php-type-hinting.php
class UserService {
public function createUser(string $name, User $parent = null, $isAdmin) : User
$user = new User($name);
return $user
vincentdesmares / sequelize-demo.js
Created Sep 11, 2017
A very simple example of how Sequelize works.
View sequelize-demo.js
const Sequelize = require('sequelize');
const sequelize = new Sequelize('database', 'username', 'password');
const User = sequelize.define('user', {
username: Sequelize.STRING,
birthday: Sequelize.DATE
.then(() => User.create({
vincentdesmares / package-json-scripts-only.json
Created Sep 11, 2017
An example of commands stored in a package.json
View package-json-scripts-only.json
"name": "my project name",
"...": "...",
"scripts": {
"release": "standard-version",
"db-reset": "rm -rf data/main.db && sequelize db:migrate && sequelize db:seed:all",
"db-migrate": "sequelize db:migrate",
"dev": "pm2 delete all; pm2 startOrReload ecosystem.config.js && pm2 start react-scripts --name web -- start",
"start": "pm2 startOrReload ecosystem.config.js",
"build": "react-scripts build",
View epilogue-minimal.js
const Sequelize = require('sequelize'),
epilogue = require('epilogue'),
express = require('express'),
bodyParser = require('body-parser');
// Define your models with Sequelize
// This is equivalent to defining Doctrine entities
let database = new Sequelize('database', 'root', 'password');
let User = database.define('User', {
username: Sequelize.STRING
vincentdesmares / app.js
Last active Sep 12, 2017
NODE Express Hello World
View app.js
const express = require('express')
const app = express()
app.get('/', function (req, res) {
res.send('Hello World!')
app.listen(3000, function () {
console.log('Example app listening on port 3000!')
yarn add --save-dev flow-bin
node_modules/.bin/flow init
yarn add pm2@latest
pm2 start app.js
wget -qO- | bash
nvm install node
nvm use v6.9.1
View webgl-10.js
function drawScene() {
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);