$> my_array=(one two three)
$> echo ${my_array}
one
// TODO: make `pages` optional and measure the div when unspecified, this will | |
// allow more normal document flow and make it easier to do both mobile and | |
// desktop. | |
import { | |
createContext, | |
useCallback, | |
useContext, | |
useEffect, | |
useMemo, | |
useRef, |
sudo: false | |
services: | |
- docker | |
before_script: | |
- sudo service docker stop | |
- if [ "$(ls -A /home/travis/docker)" ]; then echo "/home/travis/docker already set"; else sudo mv /var/lib/docker /home/travis/docker; fi | |
- sudo bash -c "echo 'DOCKER_OPTS=\"-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -g /home/travis/docker\"' > /etc/default/docker" | |
- sudo service docker start |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
<?php | |
require_once 'vendor/autoload.php'; // or however you load Twig | |
require_once 'Lexer.php'; | |
require_once 'Indent.php'; | |
$twig = new Twig_Environment(new Twig_Loader_Filesystem('templates')); | |
$twig->addExtension(new Indent_Twig_Extension()); | |
$twig->setLexer(new Indent_Twig_Lexer($twig)); |
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
; Enable Zend OPcache extension module | |
zend_extension=opcache.so | |
; Determines if Zend OPCache is enabled | |
opcache.enable=1 | |
; Determines if Zend OPCache is enabled for the CLI version of PHP | |
;opcache.enable_cli=0 | |
; The OPcache shared memory storage size. |
// npm install mongodb thunkify-wrap co | |
var mongo = require('mongodb'); | |
var t = require('thunkify-wrap'); | |
var co = require('co'); | |
co(function*(){ | |
var db = yield t(mongo.MongoClient.connect)('mongodb://127.0.0.1:27017/test'); | |
var items = db.collection('items'); | |
// cleanup |