Skip to content

Instantly share code, notes, and snippets.


Erin arcadia168

View GitHub Profile

A simple utility (node module) that can be used to order a list of objects that have both name and rank, as well as finding the average rank.

See tests for examples like the one below:

const rankingTool = require('../src/object-ranking-tool');

const rankObjects = [
        name: 'The Battle of The Bastards',
arcadia168 /
Created Jul 5, 2019
Small utility to create a customisable utility for filtering an array of people objects.

This is a small utility designed to take an array of people objects, each with name, age and gender as well as an optional set of rules for filtering those objects, and return the filtered list, grouped by the genders of the people.

By default, if no custom rules are passed in, only people between the ages of 30 and 40 will be returned.

Run and read the tests to see different inputs and outputs.

Here's an example:

const peopleFilter = require('../src/people-filter');
arcadia168 / arrayReconcilerKata.js
Created Jun 25, 2019
A small Node util done as a coding exercise to find the unique values in 2 (or more!) arrays. Should have O(n) space and time complexity so is scalable.
View arrayReconcilerKata.js
// I wrote this in a local IDE (VSCode FTW) so that I could test it before writing it here, as there is limited tooling
// Only maps through each array once, and then the object (dictionary of elements and locations) once.
// Hence, this has linear O(n) time complexity and and O(n) space complexity. This is OK, could be better.
const reconcileHelpers = (firstArray, secondArray) => {
var elementLocations = {}; // empty dictionary for super fast O(1) lookups.
const arrayParser = (element, arrayName) => {
var existingLocations = elementLocations[element];
if (existingLocations) {
arcadia168 / shipment-costs-express-server.js
Created Jun 25, 2019
A small Express servlet to work out shipping costs!
View shipment-costs-express-server.js
var express = require('express');
// Helper libraries are supplied if needed
// const _ = require('lodash')
// const r = require('ramda')
const router = express.Router()
// Same state uses the base rate on the weight;
// Different state shipments have a fixed 20% cost increase on top of the previous value (rate on weight);
// Packages can have distinct weight units, either pounds or kilograms.
// Weight needs to be validated on pounds, thus requiring conversion from kg;
arcadia168 /
Last active Jun 4, 2019
A small tool/exercise for flattening arrays

For this code exercise I went with a simple recursive solution to drill down into each array element, compiling a master array of the individual elements, aiming for elegant code which is readable and functional and ready to ship as it has tests and was written in a TDD manner (as I try to do for all of my tests).

The tests give you examples of how you would run this tool/code for it's desired effect.


const ArrayFlattenerTool = require('./array-flattener.js');
const flatArray = ArrayFlattenerTool([1, [1, [2, [3, 4]]], 5]);
arcadia168 / object-is-polyfill-kata.js
Last active Apr 26, 2019 polyfill - A small coding exercise to use JavaScript types and coercion to write my own
View object-is-polyfill-kata.js
// TODO: define polyfill for ``
if (! || true) { = function(firstValue, secondValue) {
// Take NaN into account
if (typeof(firstValue) === 'number' && typeof(secondValue) === 'number') {
if (firstValue.toString() === 'NaN' && secondValue.toString() === 'NaN') {
return firstValue.toString() === 'NaN' && secondValue.toString() === 'NaN'
arcadia168 /
Created Aug 28, 2018
[macOS] A Bash script to use the imagemagick library to make a PDF file look like it has been scanned!
brew upgrade imagemagick
convert -density 200 $1 -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray $2
arcadia168 / The Technical Interview Cheat
Created Oct 29, 2015 — forked from TSiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
arcadia168 /
Created May 23, 2015
How to add custom styles to multiple tab bars in ionic, publishing because it took me a while to figure out how to do it!
//To apply different styles nested tabs, you have to use the respective DOM positions
ion-nav-view {
ion-tabs {
/*Styling bottom nav bar */
.tab-nav.tabs {
background-color: $ygi-green !important;
.tab-item-active {
background-color: white !important;
color: black !important;
arcadia168 /
Last active Jan 19, 2020
Export Safari's Reading List to Pocket/Evernote (or any service with an "email content in" feature)
# Script to export Safari's reading list into a text file, then import this into Pocket or Evernote (or any service with a "email in content" feature).
# First take all of Safari's Reading List items and place them in a text file.
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g' > readinglistlinksfromsafari.txt
# Now loop over each of those URls within that text file and add them to pocket.
while IFS= read -r line
echo $line