Skip to content

Instantly share code, notes, and snippets.

View zs-sz's full-sized avatar

Balazs Sziklai zs-sz

View GitHub Profile
@zs-sz
zs-sz / README.md
Created February 26, 2023 00:37 — forked from mikoim/README.md
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@zs-sz
zs-sz / bitwise-hacks.js
Created January 12, 2019 14:30 — forked from leodutra/bitwise-hacks.js
Fast Int Math + Bitwise Hacks For JavaScript
// http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html
// http://jsperf.com/bitwise-vs-math-object
// http://united-coders.com/christian-harms/results-for-game-for-forfeits-and-the-winner-is/
// https://mudcu.be/journal/2011/11/bitwise-gems-and-other-optimizations/
// https://dreaminginjavascript.wordpress.com/2009/02/09/bitwise-byte-foolish/
// http://jsperf.com/math-min-max-vs-ternary-vs-if/24
"use strict";
var PI = Math.PI;
@zs-sz
zs-sz / Main.java
Created July 22, 2017 08:22 — forked from anonymous/Main.java
Random polygon packing
import processing.core.*;
import java.awt.*;
import java.util.ArrayList;
public class Main extends PApplet{
String[] palette = {"#6C8D84","#CA9D59","#AD624B","#8A5354","#3D3E53","#6C8D84","#CA9D59","#AD624B"};
ArrayList<Polygon> pol = new ArrayList<>();
public void settings(){
@zs-sz
zs-sz / error.js
Created February 15, 2017 22:00 — forked from remy/error.js
My error handler for express (though, mostly for API handling, since it always talks in JSON)
const codes = require('http-status-codes');
module.exports = (error, req, res, next) => { // jshint ignore:line
let message = null;
let n;
const { NODE_ENV } = process.env;
if (typeof error === 'number') {
n = error;
error = new Error(codes.getStatusText(error));
@zs-sz
zs-sz / fontsmoothie.js
Created June 24, 2016 14:00 — forked from letorbi/fontsmoothie.js
This code enforces font-smothing for web fonts even if it's not enabled in the system settings. More info: http://pixelsvsbytes.com/blog/2013/02/nice-web-fonts-for-every-browser
// Font Smoothie copyright 2013,14,15 Torben Haase <http://pixelsvsbytes.com>
// Source-URL <https://gist.github.com/letorbi/5177771>
//
// Font Smoothie is free software: you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option) any
// later version.
//
// Font Smoothie is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@zs-sz
zs-sz / concurrent_sync.js
Created June 10, 2016 23:56 — forked from laser/concurrent_sync.js
Modifying "sync" to do parallel stuff
function sync(gen) {
var iterable, resume, check, vals, ops;
vals = [];
ops = 0;
check = function() {
if (vals.length == ops) {
if (ops == 1) {
iterable.next(vals[0]);
@zs-sz
zs-sz / quantize.js
Created April 18, 2016 12:49 — forked from cwey/quantize.js
Fixed the two issues reported by leeoniya and by iOSBrett * green is being used again here instead of blue. (line 233) * incorrectly used rval 3 times (line 189)
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
@zs-sz
zs-sz / Off-Canvas WordPress Menu Output
Created October 3, 2015 12:44 — forked from zzramesses/Off-Canvas WordPress Menu Output
Foundation Off-Canvas WordPress Menu
<aside class="left-off-canvas-menu">
<?php wp_nav_menu(
array(
'theme_location' => 'the menu you want to use',
'container' => false,
'menu_id' => '',
'menu_class' => 'off-canvas-list',
'walker' => new Off_Canvas_Walker()
)
);