Skip to content

Instantly share code, notes, and snippets.

View joseph-abell's full-sized avatar

Joseph Abell joseph-abell

View GitHub Profile
@joseph-abell
joseph-abell / index.ts
Created February 16, 2023 07:58
Chat GPT's attempt at Scott's Tech Test
const convertNumbersToWords = (num: number): string => {
const words = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
const tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
if (num < 20) {
return words[num];
} else if (num < 100) {
return tens[Math.floor(num / 10)] + (num % 10 !== 0 ? " " : "") + words[num % 10];
} else if (num < 1000) {
return words[Math.floor(num / 100)] + " hundred" + (num % 100 !== 0 ? " and " : "") + convertNumberToWords(num % 100);
@joseph-abell
joseph-abell / elixirphoenix.bash
Created July 24, 2016 18:58 — forked from likethesky/elixirphoenix.bash
Installing Elixir & the Phoenix framework with Homebrew on OS X
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered!
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it.
$ brew install elixir
$ mix local.hex # Answer y to any Qs
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw...
# Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3
# ** Answer y to any Qs **
$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez