Skip to content

Instantly share code, notes, and snippets.

@floscr
floscr / get-a-file-list-of-changed-files-between-two-commits.sh
Created August 3, 2016 08:55
Get a file list of changed files between two commits
git diff-tree -r --name-only 5410a6d 10de24d | tr '\n' ' '
@floscr
floscr / make-all-elements-contenteditable.js
Created August 3, 2016 11:31
Make all elements contenteditable
var a = document.querySelectorAll('*');
for (var i = 0; i < a.length; i++) {
var n = a[i];
n.setAttribute('contenteditable', true);
}
@floscr
floscr / refactor-helper.css
Created August 9, 2016 07:50
Refactor CSS using a .rf-* class
// Gives all elements that have been refactored a green outline
[class*="rf-"] {
outline: 5px solid green;
}
@floscr
floscr / ignore-linting-on-file.js
Created August 10, 2016 13:54
Eslint Eshint Ignore File
/* eslint-disable */
@floscr
floscr / detect-touch.js
Created August 10, 2016 14:56
Detect Touch
document.documentElement.className += ('ontouchstart' in window || navigator.maxTouchPoints)? ' touch' : ' click';
@floscr
floscr / es6-convert-nodelist-to-array.js
Last active August 11, 2016 11:19
ES6 Convert Nodelist to Array
let products =
Array.from(document.querySelectorAll('.product'));
products
.filter(product => parseFloat(product.innerHTML) < 10)
.forEach(product => product.style.color = 'red');
@floscr
floscr / check-if-an-application-is-using-port-80
Created August 12, 2016 18:17
Check if an application is using port 80
netstat -an | grep "\.80" | grep LISTEN
@floscr
floscr / tmux-enable-true-color-mode-for-xterm.sh
Created August 15, 2016 10:12
Tmux enable true color mode for xterm
# https://sunaku.github.io/tmux-24bit-color.html#usage
tmux set-option -ga terminal-overrides ",xterm-256color:Tc"
@floscr
floscr / game-loop.js
Created August 29, 2016 19:43
Canvas Game Loop
function update(progress) {
// Update the state of the world for the elapsed time since last render
}
function draw() {
// Draw the state of the world
}
function loop(timestamp) {
var progress = timestamp - lastRender
@floscr
floscr / game-loop.js
Created August 29, 2016 19:43
Canvas Game Loop
function update(progress) {
// Update the state of the world for the elapsed time since last render
}
function draw() {
// Draw the state of the world
}
function loop(timestamp) {
var progress = timestamp - lastRender