Skip to content

Instantly share code, notes, and snippets.

View PhiSYS's full-sized avatar

David Strencsev PhiSYS

  • Cartagena, Spain
View GitHub Profile
@PhiSYS
PhiSYS / Base64BinaryUuidDecode.js
Created August 17, 2021 11:16
Convert Base64 encoded 16 byte binary UUID to Hex and hyphenate
function UuidFromBinary(binary) {
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < bytes.length; i++) {
bytes[i] = binary.charCodeAt(i);
}
let result = '';
for (let i = 0; i < bytes.length; i++) {
result += (bytes[i] & 0xFF).toString(16).padStart(2, '0');
}
@PhiSYS
PhiSYS / multiple-gource.sh
Last active December 21, 2022 04:23
Create multiple repositories visualization video using gource and ffmpeg
#!/usr/bin/bash
declare -a repos=(
"$HOME/Projects/myproject/testing/.git"
"$HOME/Projects/myproject/testing-bundle/.git"
"$HOME/Projects/myproject/service-skeleton/.git"
"$HOME/Projects/myproject/documentation-web/.git"
"$HOME/Projects/myproject/documentation-api/.git"
"$HOME/Projects/myproject/coding-standard/.git"
"$HOME/Projects/myproject/context/microservice1/.git"
@PhiSYS
PhiSYS / spintax.php
Last active April 27, 2020 07:01 — forked from irazasyed/spintax.php
PHP: Text Spinner Class - Nested spinning supported.
<?php
/**
* Spintax - A helper class to process Spintax strings.
* @name Spintax
* @author Jason Davis - https://www.codedevelopr.com/
* Tutorial: https://www.codedevelopr.com/articles/php-spintax-class/
* Modified by Mark Larsen:
* Added ability so that a fixed output can be returned.
* Modified by David Strencsev:
* Refactor and regular expression lazy optimization.
@PhiSYS
PhiSYS / roundcent.php
Created September 5, 2014 13:22
Swedish rounding for money values
/**
* Swedish rounding $nearest
*
* @param float $num
* @param float $nearest
* @return float
*/
function roundcent($num, $nearest = .05){ // default 5 cent
return round($num / $nearest) * $nearest;
}
@PhiSYS
PhiSYS / int2letters.php
Created September 5, 2014 13:02
Positive integer encoding as uppercase letters
/**
* Encode positive integers as upper case (ASCII) letters
* Encodes 0 as A, 25 as Z, 26 as AA, 51 as AZ, 52 as BA, 701 as ZZ, 702 as AAA... and so on
* @param int $int
* @return string
*/
function int2letters($int) {
$letters = '';