Skip to content

Instantly share code, notes, and snippets.

View lbragile's full-sized avatar
💻
Coding

Lior Bragilevsky lbragile

💻
Coding
View GitHub Profile
@lbragile
lbragile / hex.d.ts
Last active August 5, 2021 03:55
A complete HEX string type using Template Literal Types
// https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
type THexBase = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
type THexLower = "a" | "b" | "c" | "d" | "e" | "f";
type THexUpper = "A" | "B" | "C" | "D" | "E" | "F";
/**
* Includes 1 & 2 character hex strings.
*
* @example "0", "00", ..., "f", "ff", ..., "F", "FF"
@lbragile
lbragile / index.html
Last active January 4, 2021 02:07
Using google sheet translations to generate a JSON file containing your chosen language translations. Super useful for i18n translations!
<div>
<b>
Steps:
</b>
<ol>
<li>Use google sheets to get the translations for each language.</li>
<li>Copy the results and paste them in the <b>translations</b> object variable</li>
<li>Create a template object based on your translated words (see <b>template_obj</b> variable)</li>
<li>Run this JSFiddle</li>
<li>If not copied, copy the output and paste in a .JSON file</li>