Skip to content

Instantly share code, notes, and snippets.

@muffinista
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
#
# https://github.com/gingerbeardman/loveletter
#
# any mistakes are certainly added from me
#
@NeuroWinter
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
SuperPaintman / npm-f3-install.sh
Last active September 5, 2022 18:01
NPM install for low RAM machins. And "npm install ... killed" problem
View npm-f3-install.sh
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
@mathiasbynens
mathiasbynens / web-platform-status-links.md
Last active May 7, 2022 06:23
Web platform status links
View web-platform-status-links.md
@jackcarter
jackcarter / slack_delete.py
Last active October 13, 2022 15:22
Delete Slack files older than 30 days. Rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
View slack_delete.py
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
paulirish / what-forces-layout.md
Last active March 19, 2023 13:04
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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
tvlooy / unit.sh
Last active January 4, 2023 08:13
Bash test: get the directory of a script
View unit.sh
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
@chantastic
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
yoavniran / ultimate-ut-cheat-sheet.md
Last active March 20, 2023 04:29
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
View ultimate-ut-cheat-sheet.md
@paulirish
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;