This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserService { | |
public function createUser(string $name, User $parent = null, $isAdmin) : User | |
{ | |
$user = new User($name); | |
... | |
return $user | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Sequelize = require('sequelize'); | |
const sequelize = new Sequelize('database', 'username', 'password'); | |
const User = sequelize.define('user', { | |
username: Sequelize.STRING, | |
birthday: Sequelize.DATE | |
}); | |
sequelize.sync() | |
.then(() => User.create({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add express |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add --save-dev flow-bin | |
node_modules/.bin/flow init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add pm2@latest | |
pm2 start app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash | |
nvm install node | |
nvm use v6.9.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawScene() { | |
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | |
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); | |
requestAnimationFrame(drawScene); | |
} |
NewerOlder