What to do:
- Install dnsmasq for resolving hostnames
- Configure dnsmasq to resolve
.docker
requests to localhost - Configure macOS to send
.docker
requests to dnsmasq
brew install dnsmasq
# Create config files
import 'abortcontroller-polyfill'; | |
import ConnectionAbstract from 'elasticsearch/src/lib/connection'; | |
/** | |
* @example | |
* const client = new elasticsearch.Client({ | |
* connectionClass: FetchConnector | |
* }); | |
*/ | |
class FetchConnector extends ConnectionAbstract { |
// Assuming https://github.com/jakearchibald/idb-keyval has been used for key-value entries, | |
// the following is about the minimum code needed to read the value for a single key (w/o the lib.) | |
// Usage: `readKey('name').then(function(name) { console.log(name); });` | |
function readKey(key) { | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
if (!indexedDB) return Promise.reject(new Error('IndexedDB not available')); | |
return new Promise(function(resolve, reject) { | |
var open = indexedDB.open('keyval-store', 1); | |
If you're deploying your app to somewhere where you can't be sure to have reliable disk read/write access, the normal strategy of writing to a temp-file doesn't work.
Instead we can open a pipe to the Phantom.js process, and then pass in the HTML via stdin
, and then have the rasterize.js
script write out the resulting PDF to stdout
, which we can then capture.
Any log messages from the Phantom.js process can be passed via stderr
if we want.
#!/usr/bin/env bash | |
# Requirements: | |
# brew install jq node | |
# nvm use system; npm -g install semver | |
if [ -f package.json ]; then | |
requested_node_version=$(jq -r '.engines.node' package.json) | |
if [ "$requested_node_version" != "" ]; then | |
node_version=$(nvm_ls | xargs env NODE_VERSION=system ~/.nvm/nvm-exec semver -r "$requested_node_version") |
@keyframes radar { | |
0% { transform: rotate(0deg); } | |
100% { transform: rotate(360deg); } | |
} | |
#wifi { | |
width: 100px; height: 100px; | |
border: double 100px; | |
border-radius: 200px; | |
border-color: black transparent transparent; | |
animation: radar 3s linear infinite; |
Enable User Namespace on RHEL7:
# Notice: Use whatever is the lates version of `/boot/vmlinuz-xxx.el7.x86_64`
sudo grubby --args="user_namespace.enable=1" --update-kernel=/boot/vmlinuz-3.10.0-327.13.1.el7.x86_64
sudo reboot now
# When you implement `method_missing` you should also implement `respond_to_missing?` | |
# But the later doesn't show up as instance methods on the class, and can not be called directly! Or does it??? | |
class Foo | |
def method_missing(name, *) | |
"called #{name}" | |
end | |
def bar? | |
respond_to_missing?(:bar) |
Inspired by http://monterail.com/blog/2014/karma-on-rails/
This basically allows you to reference your application JS files, which are generated by Sprockets, in the Karma config like this:
files: [
'<%= require("application.js") %>',
'<%= require("other.js") %>',
'static/files/**/*.js'
module Kernel | |
def Boolean(input) | |
case input | |
when true, /^(true|y|yes|1)$/i, 1 | |
true | |
when false, /^(false|n|no|0)$/i, 0, "", nil | |
false | |
else | |
fail TypeError, "can't convert #{input.inspect} into boolean" | |
end |