Skip to content

Instantly share code, notes, and snippets.

@hughsw
hughsw / excelgist.js
Created Jun 23, 2019
Basic basic bootstrapping example for exceljs
View excelgist.js
// See: https://gist.github.com/nealrs/4bdcb6316665338d9a1f7c2b690d6a19
const Excel = require('exceljs');
// create workbook & add worksheet
const workbook = new Excel.Workbook();
const worksheet = workbook.addWorksheet('Discography');
// add column headers
worksheet.columns = [
@hughsw
hughsw / collectSymbols.js
Last active Jun 10, 2019
Versions of collectSymbols
View collectSymbols.js
const input = ['AED_AFN', 'ALL_AMD', 'AMD_AFN', 'ALL_GBP'];
console.log('input:', JSON.stringify(input));
// somewhat functional, somewhat imperative
const collectSymbols0 = pairs => {
co
@hughsw
hughsw / CollectCurrencyPairs.txt
Last active May 25, 2019
Javascript data wrangling
View CollectCurrencyPairs.txt
Real-world, little Javascript problem
Input is an array of strings.
Each string encodes a pair of 3-letter symbols, separated by an underscore '_'.
We talk about the left-hand and right-hand symbols that are encoded into the string.
E.g.
['AED_AFN', 'ALL_AMD', 'AMD_AFN', 'ALL_GBP']
'AED' is the left-hand symbol of the first pair; 'AFN' is the right-hand symbol of the first pair. Etc.
We want this data rearranged into an object.