Skip to content

Instantly share code, notes, and snippets.

@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active April 16, 2024 10:42
Byte formatting for Google Sheets
@Brainiarc7
Brainiarc7 / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Last active April 21, 2024 04:22
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@Bamieh
Bamieh / parse-dotless.scss
Last active December 1, 2016 13:59
Sass parse class without dot (strip dot "." from class name)
@function parse-dotless($class) {
$this: quote($class);
@return if(str-slice($this, 0, 1) == ".", str-slice($this, 2, str-length($this)), $this);
}
/*
example usage:
.14px {
font-size: parse-dotless(#{&}); // will strip the class from .14px to return 14px;
}
@BriSeven
BriSeven / decompose-matrix.js
Last active May 23, 2021 15:21
Decompose a 2D transform matrix into [rotate scale rotate translate]
function decomposeMatrix(m) {
var t,r,s,k,E,F,G,H,Q,R,sx,sy,a1,a2,theta,phi,sqrt=Math.sqrt,atan2=Math.atan2;
// http://math.stackexchange.com/questions/861674/decompose-a-2d-arbitrary-transform-into-only-scaling-and-rotation
//
// It works wonderfully! Thanks.
// The input matrix is transposed though,
// so let me spell the solution out.
E=(m[0]+m[3])/2
@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@spoike
spoike / reflux.js
Created June 29, 2014 22:23
A simpler implementation of React.JS's Flux
var EventEmitter = require('events').EventEmitter,
_ = require('lodash');
/**
* Creates an action functor object
*/
exports.createAction = function() {
var action = new EventEmitter(),
eventLabel = "action",
var easing = {
linear : function (t){
return t;
},
easeInQuad: function (t) {
return t*t;
},
easeOutQuad: function (t) {
return -1 *t*(t-2);
},
@timo22345
timo22345 / flatten.js
Last active March 13, 2024 17:06
Flatten.js, general SVG flattener. Flattens transformations of SVG shapes and paths. All shapes and path commands are supported.
<!doctype html>
<html>
<title>Flatten.js, General SVG Flattener</title>
<head>
<script>
/*
Random path and shape generator, flattener test base: https://jsfiddle.net/fjm9423q/embedded/result/
Basic usage example: https://jsfiddle.net/nrjvmqur/embedded/result/
@umaar
umaar / webdriver-hover.js
Created February 17, 2014 14:05
Hover over an element in WebDriverJS
/*
* Hover over an element on the page
*/
(function() {
"use strict";
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().usingServer().withCapabilities({'browserName': 'chrome' }).build();