Skip to content

Instantly share code, notes, and snippets.


Dumitru Uzun duzun

View GitHub Profile
alex-leonhardt / main.go
Last active Jul 19, 2021
golang text/template with a map[string]interface{} populated from mixed json data
View main.go
package main
import (
Radiergummi / Cryptor.php
Last active May 19, 2021
A PHP class to encrypt and decrypt strings using a static application secret. Input is converted to hex strings to enable easier handling
View Cryptor.php
namespace Vendor\Library;
use function bin2hex;
use function hex2bin;
use function openssl_decrypt;
use function openssl_encrypt;
use function random_bytes;
View Transliterate file names bash
# Перекодирует рекурсивно в текущем каталоге имена
# файлов и каталогов в транслит.
# Источник:
shopt -s nullglob
for NAME in * ; do
TRS=`echo $NAME | sed "y/абвгдезийклмнопрстуфхцы/abvgdezijklmnoprstufxcy/"`
inso / Nginx redirect to named location
Last active Jul 26, 2021 — forked from ilguzin/nginx_redirect_2named_location
NGINX: Redirect from current location into named location
View Nginx redirect to named location
# Solution 1
# Use only codes greater than 418, do not use common status codes 404, 402, 403, etc
location /location1 {
error_page 463 = @app; return 463;
# Solution 2 (drawbacks unknown)
location /location2 {
try_files /dev/null @app;
jherax / clone.js
Last active May 30, 2020
Clones or extends an object (deep copy) supporting objects with circular references
View clone.js
* @author
* David Rivera (jherax)
/* eslint-disable no-bitwise */
/** @private */
const toString = Object.prototype.toString;
Vestride /
Last active Jul 26, 2021
Encoding video for the web

Encoding Video


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
View umd-module.js
; (function (global, define) { define('module-name', function (require, exports, module) {
// CommonJS style code here
* UMD/AMD/Global context Module Loader wrapper
* based off
* This wrapper will try to use a module loader with the
* following priority:
yuval-a / js-micro.js
Last active Jul 13, 2021
Javascript micro-optimizations
View js-micro.js
// Array literal (= []) is faster than Array constructor (new Array())
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// Note: don't use this in cases where 'undefined' is a possible value for your properties
duzun / jq.fn.$each.js
Last active Aug 29, 2015
4-10 times faster jQuery.fn.each() replacement
View jq.fn.$each.js
* 4-10 times faster .each replacement
* use it carefully, as it overrides jQuery context of element on each iteration
* function clb(DOM, idx, $DOM, DOM) {};
* $DOM == $(DOM), is the same object throughout iteration
;(function (global) {
duzun / async_css.html
Last active Aug 29, 2015
Easiest and most natural way to load CSS asynchronously without blocking HTML rendering! Tested on and other projects by DUzun.ME
View async_css.html
<!-- The <script> switches rel="prefetch" to rel="stylesheet" at proper time, et voila, magic happens :-) -->
<link rel="prefetch" type="text/css" href="" />
<link rel="stylesheet" type="text/css" href="" />
<link rel="stylesheet" type="text/css" href="" />
<link rel="prefetch" type="text/css" href="" />