Skip to content

Instantly share code, notes, and snippets.

muffinista / loveletters.rb
Created April 4, 2017 17:41
ruby version of LOVELETTERS
View loveletters.rb
#!/usr/bin/env ruby
# this code is modified from
# any mistakes are certainly added from me
NeuroWinter / ffmpeg cheatsheet for glitching
Last active March 3, 2023 22:03
ffmpeg cheatsheet for glitching
View ffmpeg cheatsheet for glitching
FFMPEG '-i', file, '-c:v', 'libopenjpeg', "jpeg2000\\" + name + ".jp2"\
Convert image to jpeg2000
ffmpeg -i in.png -c:v libopenjpeg out.jp2
Hex Edit out.jp2
ffmpeg -i in.jp2 -c:v png out.png
General Edit
ffmpeg -i input.avi -c:v mpeg2video -g 999 -q:v 1 output.avi
*edit in avidemux/whatever*
SuperPaintman /
Last active September 5, 2022 18:01
NPM install for low RAM machins. And "npm install ... killed" problem
# Author: SuperPaintman <>
# Constants
mathiasbynens /
Last active May 7, 2022 06:23
Web platform status links
jackcarter /
Last active October 13, 2022 15:22
Delete Slack files older than 30 days. Rewrite of
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
paulirish /
Last active March 19, 2023 13:04
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
tvlooy /
Last active January 4, 2023 08:13
Bash test: get the directory of a script
function test {
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
chantastic / on-jsx.markdown
Last active March 18, 2023 03:50
JSX, a year in
View on-jsx.markdown

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

yoavniran /
Last active March 20, 2023 04:29
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
paulirish / bling.js
Last active March 18, 2023 15:36
bling dot js
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
NodeList.prototype.__proto__ = Array.prototype;