Tested under webpack-dev-server 1.7.0.
- Clone this gist
npm install
npm start
- Visit http://localhost:8080 (or http://192.168.x.x:8080) on multiple devices
- Edit entry.js and hit save
/* eslint-disable no-unused-vars */ | |
/* eslint-disable no-else-return */ | |
// JSX constructor, similar to createElement() | |
export const h = (type, props, ...children) => { | |
return { | |
type, | |
// Props will be an object for components and DOM nodes, but a string for | |
// text nodes | |
props, |
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |
#!/bin/bash | |
find . -name '*.mp3' -exec afplay '{}' \; |
#include <mach/port.h> /* mach_port_t */ | |
#include <mach/mach.h> /* mach_port_allocate(), mach_task_self(), mach_port_insert_member(), MACH_PORT_RIGHT_PORT_SET */ | |
#include <sys/event.h> /* kqueue(), kevent64(), struct kevent64_s, EVFILT_MACHPORT, EV_SET64, EV_ADD */ | |
#include <sys/time.h> /* struct timespec */ | |
//#include <dispatch/private.h> | |
extern mach_port_t _dispatch_get_main_queue_port_4CF(void); | |
extern void _dispatch_main_queue_callback_4CF(void); | |
#include <stdio.h> |
# script insstalls qemu and vagrant, then uses vagrant to build a qemu- | |
# supported rpi kernel for dev. | |
# - tested with 2015-02-16-raspbian-wheezy.zip on OSX El Capitan | |
# Variables | |
IMAGE=http://downloads.raspberrypi.org/raspbian_latest | |
IMG_PATH="/vagrant/raspbian_latest.img" | |
PI_LINUX=https://github.com/raspberrypi/linux | |
PI_LINUX_BRANCH="rpi-4.2.y" | |
PI_TOOLS=https://github.com/raspberrypi/tools |
Tested under webpack-dev-server 1.7.0.
npm install
npm start
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.
On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.
So, many developers have started going straight t
The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:
export
syntax, without breaking consumers that do require("function-module")()
?import
syntax, while not demanding that the module author rewrites his code to ES6 export
?@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.
This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.