Skip to content

Instantly share code, notes, and snippets.

Avatar

David Strencsev PhiSYS

  • Cartagena, Spain
View GitHub Profile
@PhiSYS
PhiSYS / Base64BinaryUuidDecode.js
Created Aug 17, 2021
Convert Base64 encoded 16 byte binary UUID to Hex and hyphenate
View Base64BinaryUuidDecode.js
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 Apr 8, 2022
Create multiple repositories visualization video using gource and ffmpeg
View multiple-gource.sh
#!/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 Apr 27, 2020 — forked from irazasyed/spintax.php
PHP: Text Spinner Class - Nested spinning supported.
View spintax.php
<?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 Sep 5, 2014
Swedish rounding for money values
View roundcent.php
/**
* 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 Sep 5, 2014
Positive integer encoding as uppercase letters
View int2letters.php
/**
* 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 = '';