You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
/* Cranium MVC | |
* A minimalist MVC implementation written for | |
* demonstration purposes at my workshops | |
* http://addyosmani.com | |
* Copyright (c) 2012 Addy Osmani; Licensed MIT */ | |
var Cranium = Cranium || {}; | |
// Set DOM selection utility |
@media only screen and (min-width: 320px) { | |
/* Small screen, non-retina */ | |
} | |
@media | |
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px), | |
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px), | |
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px), |
#!/usr/bin/env ruby | |
begin | |
require 'acme-client' | |
rescue LoadError | |
abort 'MISSING GEM! You haven\'t installed the ACME client. Install the gem with the command \'gem install acme-client\'.' | |
end | |
require 'openssl' | |
require 'resolv' |
You update your app.js
or styles.css
, but have a caching of 30 days and none of the clients will get the latest version? 😟
While the best would be to use a build mechanism to generate new filenames on the server, here is how to ensure clients get your last updates:
1. Change the name of the files in the HTML, for example styles.css
to styles.123.css
2. Add this cache busting snippet in your nginx conf:
Permalink: git.io/vps
Provider | Type | RAM | Cores | Storage | Transfer | Network | Price |
---|
This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps
argument of the connect
function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps
can take.
{ | |
"scripts" : { | |
"tests" : "composer fixes && composer sniffs && composer lints && phpunit --coverage-clover coverage/clover.xml", | |
"sniffs" : "phpcs --standard=PSR2 src/ && phpcs --standard=PSR2 tests/", | |
"fixes" : "php-cs-fixer fix src/ && php-cs-fixer fix tests/", | |
"lints" : "parallel-lint ./src --blame --exclude vendor && parallel-lint ./tests --blame --exclude vendor" | |
} | |
} |