/* bling.js */ | |
window.$ = document.querySelector.bind(document); | |
window.$$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
NodeList.prototype.__proto__ = Array.prototype; | |
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" | |
viewBox="0 0 1000 20" preserveAspectRatio="none" width="100%" height="20"> | |
<polygon points="0,0 1000,0 500,20" style="fill:#cc3333; stroke: lightgrey; stroke-width: 6;"/> | |
</svg> |
/** | |
* In order to get the cursor position / selection for a contenteditable HTML element, we need to do some | |
* fancy stuff. This is necessary for the editable-text directive (and possibly others in the future). This code comes | |
* from the following stack overflow post: | |
* | |
* http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html/13950376#13950376 | |
* Example here: | |
* http://jsfiddle.net/WeWy7/3/ | |
* | |
*/ |
#!/bin/sh | |
remove_dangling() { | |
echo "Removing dangling images ..." | |
docker rmi $(docker images -f dangling=true -q) | |
} | |
remove_stopped_containers() { | |
echo "Removing stopped containers ..." | |
docker rm $(docker ps -qa) |
# Add 'source ~/.zsh_alias' to the bottom of ~/.zshrc to use | |
# Can also add to these to /Homestead/aliases for us with your Homestead VM | |
# Composer | |
alias csu="composer self-update" | |
alias cu="composer update" | |
alias ci="composer install" | |
alias cda="composer dump-autoload -o" | |
# Laravel / Artisan |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.
TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/
For async JavaScript file requests, we have the async
attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).
Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited | |
# | |
# Current known FCC address ranges: | |
# https://news.ycombinator.com/item?id=7716915 | |
# | |
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft | |
# | |
# In your nginx.conf: | |
location / { |
(function (root) { | |
var type = function (o) { | |
// handle null in old IE | |
if (o === null) { | |
return 'null'; | |
} | |
// handle DOM elements |