<!-- Add this to your Rails app's body tag -->
<body data-controller="<%= request[:controller] %>" data-action="<%= request[:action] %>">
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Find and log every DOMNode on the page which isn't using Proxima Nova | |
| // as its font-family | |
| function isHeretic(node) { return (window.getComputedStyle(node).fontFamily.indexOf('proxima-nova') < 0) } | |
| function isVisible(node) { return (window.getComputedStyle(node).display !== 'none') } | |
| function log(node) { console.log(node, window.getComputedStyle(node).fontFamily) } | |
| function toArray(domlist) { return Array.prototype.slice.call(domlist) } | |
| toArray(document.querySelectorAll('#fs-main-content *')).filter(isHeretic).filter(isVisible).forEach(log) |
This repo has some handy handy hooks to run bundle or npm install whenever you:
git checkouta new branch with a different Gemfile or package.jsongit pulla change to Gemfile or package.json
git clone https://gist.github.com/5869846.git hooks && cd hooks && chmod +x install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cert_file="$( openssl version -d | awk -F'"' '{print $2}' )/cert.pem" | |
| mkdir -p "${cert_file%/*}" | |
| security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file" | |
| security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while [[ -n $(port list leaves 2> /dev/null) ]]; do | |
| sudo port uninstall leaves | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var playlist = $('.songs .song').toArray().map(function(song) { | |
| var song = $(song) | |
| , deets = song.find('.details').text().split(' • ') | |
| , image = $(song).find('.thumb').attr('style') | |
| return { | |
| title: song.find('.title').text(), | |
| artist: deets.shift(), | |
| length: deets.shift(), | |
| cover: image ? /\((.*)\)/.exec(image).pop() : null |
node pruneCss.js styles.css output > strippedFile.cssUse Chrome's audit panel to get a list of unused CSS selectors on the current page, and, presuming your CSS file conforms to the style of "[selector] {all; rules; one: one-line;}" this script will print out the CSS file, omitting the unused selectors.
What does this do?
- Spawns as many workers with your web server as you have CPUS
- The domain around the worker will catch any errors the worker allows to escape, and escaped errors are punishable by death.
- If a worker crashes, it's rebooted
- If a worker exits cleanly (suicides), it's not replaced
- Sending "SIGINT" to the master process will gracefully shutdown the child instances and then exit the master process

