Skip to content

Instantly share code, notes, and snippets.

View SmartArray's full-sized avatar
🚀
Hire me!

Yoshi Jäger SmartArray

🚀
Hire me!
View GitHub Profile
@SmartArray
SmartArray / timeDisplay.ts
Created January 14, 2025 15:04
Displays the time difference in words for a past or future Date object, e.g. 20 seconds left or 5 days ago
export function renderSeconds(seconds: number, suffix: string): string {
if (seconds < 0) return `0 seconds ${suffix}`;
if (seconds < 60) {
return `${seconds} second${seconds === 1 ? '' : 's'} ${suffix}`;
}
const minutes = Math.floor(seconds / 60);
if (minutes < 60) {
return `${minutes} minute${minutes === 1 ? '' : 's'} ${suffix}`;
@SmartArray
SmartArray / generate_icons_from_svg.sh
Last active December 1, 2020 04:54
Generate Icons from SVG for Android and iOS
#!/bin/sh
# Author: Yoshi Jaeger
# License: MIT
#
# Description: This script converts an svg file to all required sizes
# for iOS and Android. Two directories will be created next to
# the icon (ios/ and android/) in which the generated files will
# reside. Be careful and ensure these directories do not exist
# prior executing this script.
#
@SmartArray
SmartArray / cppTimingLogger.md
Last active November 27, 2019 12:09
C++ TimingLogger (Java equivalent)

C++ equivalent for Androids Timing Logger

This snippet is a drop-in header

/**
 * Timing Logger, Author: Yoshi Jaeger
 * LICENSE: MIT
 */
@SmartArray
SmartArray / faircoin-install.md
Last active October 21, 2019 11:49
Install updated FairCoin Core node

Install updated faircoin core node

Clone git repository

git clone https://github.com/SmartArray/faircoin-1.git -b extended-headers
cd faircoin-1

This clones my repository including the new extension (branch: extended-headers).

Compile

/* Convert endianness of hex input */
String.prototype.rev = function () { return this.match(/.{1,2}/g).reverse().join("") }
"ae5a2f6f11d841e3351b49341cda6e9e097324c23d5a866a2fa0cfc566a402ef".rev() ==
"ef02a466c5cfa02f6a865a3dc22473099e6eda1c34491b35e341d8116f2f5aae"