A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
Psql is a fully-fledged CLI client for Postgres, but most people are unaware of its many advanced features.
~/.psqlrc
can be edited to persist any behavior or configuration settings you want between psql sessions. It behaves just like ~/.bashrc or ~/.vimrc, sourced at psql launch. See More out of psql for some interesting configurations.
If you have a long query to write and rewrite, you can use \e
to edit your query in an editor.
Use \watch
at the end of a query in order to automatically re-run the query every few seconds - great for monitoring while making changes elsewhere in your application architecture.
// A Declarative Pipeline is defined within a 'pipeline' block. | |
pipeline { | |
// agent defines where the pipeline will run. | |
agent { | |
// This also could have been 'agent any' - that has the same meaning. | |
label "" | |
// Other possible built-in agent types are 'agent none', for not running the | |
// top-level on any agent (which results in you needing to specify agents on | |
// each stage and do explicit checkouts of scm in those stages), 'docker', |
pure()
can be used as a higher order function or a decorator.
When passed a pure functional component, it wraps the function in a classful Component with a shouldComponentUpdate()
that ignores renders for unchanged props.
When passed a classful Component, it injects a shouldComponentUpdate()
method into the Component's prototype that ignores renders for unchanged props & state.
import pure from 'pure-component';
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
import React from 'react'; | |
const MIN_SCALE = 1; | |
const MAX_SCALE = 4; | |
const SETTLE_RANGE = 0.001; | |
const ADDITIONAL_LIMIT = 0.2; | |
const DOUBLE_TAP_THRESHOLD = 300; | |
const ANIMATION_SPEED = 0.04; | |
const RESET_ANIMATION_SPEED = 0.08; | |
const INITIAL_X = 0; |
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
# Sample Nginx config with sane caching settings for modern web development | |
# | |
# Motivation: | |
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools. | |
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh | |
# and juicy version of your assets available. | |
# At some point, however, you want to show your work to testers, your boss or your client. | |
# After you implemented and deployed their feedback, they reload the testing page – and report | |
# the exact same issues as before! What happened? Of course, they did not have developer tools | |
# open, and of course, they did not empty their caches before navigating to your site. |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents