Skip to content

Instantly share code, notes, and snippets.

View lokeb's full-sized avatar

Loknath Bharti lokeb

View GitHub Profile
@lokeb
lokeb / react-object.js
Created August 30, 2018 18:22
React recurse through and render an object
const renderObj = (obj) => Object.entries(obj).map((el) => (
<div>
<div>el[0]</div>
<div>el[1]</div>
</div>
))
@lokeb
lokeb / Currency.js
Created August 23, 2018 20:32
109 Currency symbols in an Array in Unicode
const Symbols = [
["Country and Currency", "Currency Code", "Unicode: Hex"],
["Albania Lek", "ALL", "\u004c\u0065\u006b"],
["Afghanistan Afghani", "AFN", "\u060b"],
["Argentina Peso", "ARS", "\u0024"],
["Aruba Guilder", "AWG", "\u0192"],
["Australia Dollar", "AUD", "\u0024"],
["Azerbaijan Manat", "AZN", "\u20bc"],
["Bahamas Dollar", "BSD", "\u0024"],
["Barbados Dollar", "BBD", "\u0024"],
@lokeb
lokeb / parser.js
Created August 23, 2018 20:20
Parse currency symbols from https://www.xe.com/symbols.php into a csv string
var tdr = $('table')[0].children[0].children;
var out = '';
$.each(tdr, (c, el) => {
const els = el.children;
var curr = '';
var ucs = els[6].textContent.trim();
if(ucs.length) {
ucs = ucs.split(",");
for(var i = 0; i < ucs.length; i++) {
curr += (c > 0 ? '\\u' : '') + ucs[i].trim().padStart("4", "0");
@lokeb
lokeb / String.js
Created August 23, 2018 19:31
Prototype methods to convert Currency.csv Unicode values
String.prototype.hexDecode = function () {
var j;
var hexes = this.split("\\u").slice(1);
var back = "";
for (j = 0; j < hexes.length; j++) {
back += String.fromCharCode(parseInt(hexes[j], 16));
}
return back;
}
@lokeb
lokeb / Currency.csv
Last active March 28, 2025 06:41
Currency of 109 countries with symbols in unicode
Country and Currency Currency Code Unicode: Hex
Albania Lek ALL \u004c\u0065\u006b
Afghanistan Afghani AFN \u060b
Argentina Peso ARS \u0024
Aruba Guilder AWG \u0192
Australia Dollar AUD \u0024
Azerbaijan Manat AZN \u20bc
Bahamas Dollar BSD \u0024
Barbados Dollar BBD \u0024
Belarus Ruble BYN \u0042\u0072