Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.
Author: Chris Lattner
| exports.knex = require('knex')({ | |
| client: 'pg', | |
| connection: { | |
| host : '127.0.0.1', | |
| user : 'your_database_user', | |
| password : 'your_database_password', | |
| database : 'myapp_test' | |
| } | |
| }); |
| const types = { | |
| ADD_TODO: 'ADD_TODO', | |
| DELETE_TODO: 'DELETE_TODO', | |
| COMPLETE_TODO: 'COMPLETE_TODO', | |
| }; | |
| const socketEvents = { | |
| ADD_TODO_SUCCESS: 'ADD_TODO_SUCCESS', | |
| ADD_TODO_FAIL: 'ADD_TODO_FAIL', | |
| }; |
A massive list of anything I might have missed
React is really two things: a way to abstract DOM creation and a way of building UI that removes a lot of boilerplate.
React can feel very old school sometimes, in a good way—First get server-side rendering working, much later add client JS as an optimisation via https://twitter.com/markdalgleish/status/580098832043655168
| // This script will boot app.js with the number of workers | |
| // specified in WORKER_COUNT. | |
| // | |
| // The master will respond to SIGHUP, which will trigger | |
| // restarting all the workers and reloading the app. | |
| var cluster = require('cluster'); | |
| var workerCount = process.env.WORKER_COUNT || 2; | |
| // Defines what each worker needs to run |
The easiest way to load the Mysql Time Zone tables from your Mac OS time zone fields is via this command:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
However, on many systems like mine that will fail because some of the time zone information is incompatible with the database schema for the time zone tables.
Therefore, you'll want to load the time zone information into a text file and edit it to only include the time zones you need. (Or, attempt to find the data breaking the import.)
mysql_tzinfo_to_sql /usr/share/zoneinfo > zone_import.sql
| // Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream, | |
| // Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback | |
| var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance | |
| // For live streaming, create a fragmented MP4 file with empty moov (no seeking possible). | |
| var reqUrl = url.parse(req.url, true) | |
| var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined; | |
| if (cameraName) { | |
| try { | |
| cameraName = decodeURIComponent(cameraName); |
