Profile | download (kb/s) | upload (kb/s) | latency (ms) |
---|---|---|---|
Native | 0 | 0 | 0 |
GPRS | 50 | 20 | 500 |
56K Dial-up | 50 | 30 | 120 |
Mobile EDGE | 240 | 200 | 840 |
2G Regular | 250 | 50 | 300 |
2G Good | 450 | 150 | 150 |
3G Slow | 780 | 330 | 200 |
/** | |
* subscriptions data format: | |
* { eventType: { id: callback } } | |
*/ | |
const subscriptions = { } | |
const getNextUniqueId = getIdGenerator() | |
function subscribe(eventType, callback) { | |
const id = getNextUniqueId() |
This issue is so infuriating that I'm going to take some time to write about it.
-
MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g.
polymer serve --hostname domain.local
,hugo serve --bind 0.0.0.0
. If you use a named domain likedomain.local
, it has to be defined in/etc/hosts
and pointing at 0.0.0.0. -
My Parallels setting is using Shared Network, nothing special there.
-
Open macOS Terminal and type
ifconfig
. Look for the value undervnic0
>inet
. It is typically10.211.55.2
.
# Linux | |
# add the following to "~/.gitconfig" file | |
[merge] | |
tool = intellij | |
[mergetool "intellij"] | |
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED") | |
trustExitCode = true | |
[diff] |
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.
function fpsMeter() { | |
let prevTime = Date.now(), | |
frames = 0; | |
requestAnimationFrame(function loop() { | |
const time = Date.now(); | |
frames++; | |
if (time > prevTime + 1000) { | |
let fps = Math.round( ( frames * 1000 ) / ( time - prevTime ) ); | |
prevTime = time; |
/** | |
* Language Selector Shortcode | |
*/ | |
function qtranxf_generateLanguageSelectorShortcode() { | |
global $q_config; | |
if(is_404()) $url = get_option('home'); else $url = ''; | |
echo PHP_EOL.'<div style="text-transform: uppercase;" class="lang-sel sel-dropdown"><a href="#"><span>'.$q_config['language'].'</span></a><ul>'.PHP_EOL; | |
foreach(qtranxf_getSortedLanguages() as $language) { |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
#!/bin/bash | |
# | |
# waitForX [<cmd> [<arg> ...]] | |
# | |
# Wait for X Server to be ready, then run the given command once X server | |
# is ready. (Or simply return if no command is provided.) | |
# | |
function LOG { | |
echo $(date -R): $0: $* |