il faut voir / lire / écouter tout les partis
prendre du recul
surtout vérifier ses sources
se faire son avis
Voila ce qu’on ne montre pas ou trop peu
| // HELPERS | |
| const print = s => process.stdout.write(s) | |
| const Array2d = (rows, cols, fill = 0) => Array(rows).fill(0).map(_ => Array(cols).fill(fill)) | |
| // const wait = ms => new Promise(_ => setTimeout(_, ms)) | |
| const Game = require('./Game.js') |
| # install postgres | |
| brew install postgresql | |
| # set service to restart postgres on startup | |
| pg_ctl -D /usr/local/var/postgres start && brew services start postgresql |
| const openingHours = { | |
| monday: [ | |
| { begin: '10:00', end: '12:00' }, | |
| { begin: '13:00', end: '18:00' }, | |
| ], | |
| tuesday: [ | |
| { begin: '10:00', end: '12:00' }, | |
| { begin: '13:00', end: '18:00' }, | |
| ], | |
| wednesday: [ |
| import React, { Component } from 'react' | |
| import store from './store.js' | |
| class App extends Component { | |
| componentDidMount() { | |
| // subscribe to changes -> forceUpdate will ask React to re-render the view | |
| this.unsubscribe = store.subscribe(() => this.forceUpdate()) | |
| } |
| import React, { Component } from 'react' | |
| import store from './store.js' | |
| class App extends Component { | |
| componentDidMount() { | |
| // subscribe to state changes -> forceUpdate will ask React to re-render the view | |
| this.unsubscribe = store.subscribe(() => this.forceUpdate()) | |
| } |
| #bg { | |
| position: fixed; | |
| background-image: url("http://cosmetotheque.com/wp-content/uploads/2018/04/mario-gogh-589733-unsplash-1200x385.jpg"); | |
| filter: blur(2px); | |
| width: 1000px; | |
| height: 300px; | |
| } | |
| #content { | |
| position: relative; |
| const connect = require('monk') | |
| const url = 'mongodb://localhost:27017/livecodings' | |
| const handler = { get: (obj, prop) => obj[prop] || obj.get(prop) } | |
| const db = new Proxy(connect(url), handler) | |
| // db.users -> access 'users' collection instead of db.get('users') | |
| const readUsers = async () => db.users.find({}) | |
| readUsers.byId = id => db.users.findOne({ _id: id }) |
| const flatKeys = (object, keys = [], k = '') => { | |
| for (const key in object) { | |
| const rest = k.length ? '.' + key : key | |
| if (typeof object[key] === 'object' && !Array.isArray(object[key])) { | |
| flatKeys(object[key], keys, k + rest) | |
| } else { | |
| keys.push(k + rest) | |
| } | |
| } |