Commit graph

1179 commits

Author SHA1 Message Date
William Carroll
155dff562a Impl part 3/3 for Memo
Refactor the caching policy for the Memo by evicting the elements that have been
the least-recently-accessed.

Python's heapq module default to a min-heap. By storing our heap elements
as (UnixTime, a), we can guarantee that when we call heappop, we will get the
element with the lowest UnixTime value in heap (i.e. the oldest). When we call
heappush, we use (time.time(), key) and these values -- by having the largest
UnixTime, will propogate to the bottom of the min-heap.
2020-07-01 15:13:56 +01:00
William Carroll
a8b3a2d3c0 Support part 2/3 for the Memo problem
Bound the size of the memo by creating a BoundedQueue. Whenever we add elements
to the BoundedQueue, we remove the oldest elements. We use the BoundedQueue to
control the size of our dictionary that we're using to store our key-value pairs.
2020-07-01 14:59:49 +01:00
William Carroll
ec7c8516f7 Implement part 1/3 for "Memo"
After hearing from a Jane Street recruiter, I decided to dust off some of the
DS&As knowledge. I found this article online, which outlines an example problem
called "Memo":

https://blog.janestreet.com/what-a-jane-street-dev-interview-is-like/

Here's part 1 of the solution in Python.
2020-07-01 14:40:40 +01:00
William Carroll
011f7aeaec Convert grocery list to an .org file
Ensure that the export.hs script refers to the .org file.
2020-07-01 10:45:28 +01:00
William Carroll
ee1aeee5f8 Complete exercises for Reader and State chapters
It's beautiful how State is just Reader that returns a tuple of (a, r) instead
of just a, allowing you to modify the environment (i.e. state).

```haskell
newtype Reader r a = Reader { runReader :: r -> a }
newtype State s a = State { runState :: s -> (a, s) }
```
2020-07-01 10:42:57 +01:00
William Carroll
c4fe3c92c7 Create a .ghci for this directory
I would've created on at $HOME/.ghci, but I don't need that yet, and I didn't
want to bother with home-manager.
2020-07-01 10:38:56 +01:00
William Carroll
d820898de5 Complete exercises from Traversable chapter
I feel much more comfortable using `traverse` and `sequenceA`. I even used both
of them in the Haskell program that I wrote at work to export a trix.
2020-07-01 10:37:54 +01:00
William Carroll
82b40e8d37 Now removing "Closed"
At this point, I'm starting to lose interest.
2020-06-30 23:22:13 +01:00
William Carroll
7e6daaf21a Prefer "Closed" authMode
Setting `authMode = "Registered"` prevents me from running the `register
<password>` command from inside of `bitlbee`, which I *believe* I need to
run...
2020-06-30 23:12:18 +01:00
William Carroll
fa4eb2c61b Remove auth from Bitlbee
I'm having trouble getting PAM auth to work, so I'm temporarily disabling it.

TIL that I can use the following to verify that PAM is properly setup for a
program (e.g. `bitlbee`).

```
pamtester -v bitlbee $(whoami) authenticate
```

...but despite this succeeding, I still cannot use the `identify` command in
`bitlbee` to successfully authenticate. It just tells me "Incorrect password"
even though I'm providing it the same password that I type when doing the
`pamtester` command from above.

Computers!
2020-06-30 23:02:57 +01:00
William Carroll
a276eddf54 Add auth to bitlbee
Use Linux's PAM for Bitlbee's auth.
2020-06-30 20:01:01 +01:00
William Carroll
6cb921739d Support bitlbee + stunnel
TLS support for bitlbee...
2020-06-30 19:53:10 +01:00
William Carroll
58dc543a7b Open :6667
Attempt to access Bitlbee from IRCCloud.com client...
2020-06-30 18:59:43 +01:00
William Carroll
4d577bd8a9 Support bitlbee
I'm still not entirely sure what bitlbee does, but I know this: I want as many
messengers in the same place as possible: IRC, Slack, Telegram. @tazjin tells me
that Bitlbee will help me get to the promised land. This is hopefully one step
of many in that direction.
2020-06-30 17:55:11 +01:00
William Carroll
da24a38995 Group groceries/list
- Change list.txt -> list.org
- Group groceries by category
- Sort categories by store layout
2020-06-27 14:24:02 +01:00
William Carroll
25a45fb222 Add export script for groceries
At this point, I may be taking this idea too far, but what the heck?
2020-06-27 14:06:59 +01:00
William Carroll
362a31166d Create Nix shell for Haskell scratchpad
Helps me run my chapter exercises.
2020-06-18 11:08:55 +01:00
William Carroll
a981bb0d4a Complete the Monad chapter
From "Haskell Programming from First Principles"...

I have completed all of the exercises in the book thus far, but I only recently
dedicated a Haskell module for each chapter. Previously I created ad hoc modules
per exercise, per chapter... it was chaotic.
2020-06-18 11:07:55 +01:00
William Carroll
71e79f5f5d Complete exercises from Applicative chapter
From "Haskell Programming from First Principles"...
2020-06-18 11:07:03 +01:00
William Carroll
406764f552 Complete exercises from Foldable chapter
I'm creating Haskell modules to host my attempts and solutions for the exercises
defined in each chapter of "Haskell Programming From First Principles".
2020-06-18 11:05:49 +01:00
William Carroll
766a2a6b78 Add grocery list for Shaalsee
Mimi and I will go to the grocery store every Monday here. If we track what we
buy, we can easily generate grocery lists that get better over time.
2020-06-16 21:01:02 +01:00
William Carroll
338f855f8f Update Clojure boilerplate docs
After consuming some of this boilerplate for a TopTal assessment, I found a few
inconsistencies with my docs.
2020-06-16 11:51:57 +01:00
William Carroll
3e33382675 Don't start ssh-agent in .profile
Problem: My SSH is behaving strangely.
Reason: I'm not sure. What I do know, however, is that Google handles SSH
differently. So I think that's enough for me to know I should keep my hands off
and not wrestle with it.
2020-06-16 11:50:47 +01:00
William Carroll
183b306159 Use ivy-helpers/list-external-commands
Without the ivy-helpers/ namespace, I believe this code is buggy.
2020-06-16 11:49:56 +01:00
William Carroll
f4fa363c19 Prefer Solarized Light theme
I've said it once, and I'll say it again: my preferences often change.
2020-06-16 11:49:33 +01:00
William Carroll
ef3cba1b39 Support additional KBDs for Clojure
Define KBDs in clojure-mode-map that resemble my common-lisp and elisp KBDs.
2020-06-16 11:48:44 +01:00
William Carroll
83c193ece6 Include new TODO in finances.org
Ensure that I settle my balance with Mimi each month.
2020-06-16 11:47:55 +01:00
William Carroll
b1e358f247 Use dot-time format for modeline timestamp
My current understanding of how computers deal with time:
- Modelling time is easy: use the number of seconds that have elapsed since the
  Unix epoch.
- Display time is complicated. Which timezone should we use? Which format
  string?
2020-06-16 11:46:17 +01:00
William Carroll
675b8084c7 Prefer smaller default font size for laptop
I'll be working without an external monitor for the next few months, so I prefer
this smaller size.
2020-06-16 11:37:24 +01:00
William Carroll
05a2ea6bb7 Support boilerplate for Elm clients
Lately I was toiling while writing a ClojureScript client. This made me crave
Elm. I'm going to rewrite the ClojureScript client using Elm, but along the way,
I'm stopping off here and recording my starter boilerplate.
2020-05-17 20:48:18 +01:00
William Carroll
066b1441b2 Support //boilerplate/clojure
While this is most likely incomplete or even erroneous, I'd like to start
supporting Clojure in this repository.
2020-05-04 12:32:50 +01:00
William Carroll
7a7c29d46c Restore default view to Overview
I often debug by changing the values of State.Model in the State.init
function. I usually revert these these chage; this time I didn't.
2020-04-19 19:49:15 +01:00
William Carroll
d84d0000e0 Correct all G_sharp pitch classes
I incorrectly modelled all of the G-sharps in my application as belonging to the
G pitchClass, which resulted in a strange bug where vieChord printed "G minor
Root position", but the Piano highlit a G minor.

I checked the other accidentals, and it looks like everything is properly
classified.
2020-04-19 19:11:17 +01:00
William Carroll
ae31090a46 Remove unused Msg's
I'm sure this app contains more unused code. I would like to find some Elm tools
for detecting and deleting dead code, but this isn't my current priority.

My current priority is dogfooding this app until I find it genuinely useful for
myself.
2020-04-19 19:02:25 +01:00
William Carroll
541c40cd2f Ensure only whitelisted chord inversions present in initial state
Whoops...
2020-04-19 19:02:17 +01:00
William Carroll
a059c32403 Display "Get ready..." message before practicing
This is a temporary solution. Ideally I would like to handle this with the
following:

- Show the flashcard for a chord shortly after beginning a practice session
- Display a small 3...2...1... countdown timer immediately after beginning a
  practice session

I need to dig more deeply into Elm's Time module and subscriptions to better
understand how to properly solve this problem. In the meantime, please tolerate
this short-term solution.
2020-04-19 18:51:42 +01:00
William Carroll
4a8f750ba8 Restore support for whitelisted chord inversions
Allow users to include or exclude chord inversions.
2020-04-19 18:36:22 +01:00
William Carroll
14f11823ff Drop support for PracticeMode
For now, I'd like to support selecting keys and whitelisting inversions.
2020-04-19 18:23:01 +01:00
William Carroll
d134db700f Support a FlashCard before showing the notes that comprise a chord
My much anticipated feature: first prompt the user for a name of a chord, then
show the user that chord.

Cascading changes:
I changed the "Tap to practice" overlayButton's opacity from 30% to 100% because
pausing when showFlashCard is True causes the two piece

TIL:
You can batch Elm Subscriptions using the Sub.batch function.

What I haven't learned yet:
How to best handle rotating screens for mobile devices (i.e. portrait
vs. landscape modes). In time...

What's left?
- Support sound
- Support a fine-tune section of the preferences
- Support tablet and web browser variants
- Ask users for the "I chord" instead of asking "C major Root position"
- More styling (of course)
2020-04-19 15:32:20 +01:00
William Carroll
f92fe97aff Create Tailwind module
Moving the UI.tw function into Tailwind.use. Creating and consuming some
functions like Tailwind.if_ and Tailwind.when to make it easier to conditionally
style some of my components.
2020-04-19 13:42:37 +01:00
William Carroll
7b2163d804 Ensure the overlayButton is truly h-screen and w-screen
Now the "Tap to practice" button fully covers the screen.

- Dropped support for a Piano direction (for now)
- Using w-full and w-1/2 for piano key "length"
2020-04-19 13:14:18 +01:00
William Carroll
2fe6d7a10c Responsively size UI
TL;DR: scale down UI for non-mobile devices.

I pulled the screen resolution for my phone, the Google Pixel 4, off of the
internet. I created a device profile in Chrome to develop this application
specifically for my phone. To my surprise, when I opened the app on my phone,
many of elements that looked good in Google Chrome, looked askew on my phone. I
needed to troubleshoot.

Here's how I did that:
I used Tailwind to responsively color the bg for each breakpoint to see if my
device was sm, md, lg, xl (according to Tailwind's breakpoint
terminology). After reading Tailwind's documentation and comparing their
breakpoints with my Pixel 4's width (i.e. 1080px), I figured that my device
would be lg. It's not; it's md, which I confirmed by using ngrok to load
localhost:8000 on my phone and see that the background-color was
"md:bg-green-600".

I'm still unsure why my device is not lg, but knowing that my device was md
was enough to fix many of the styling issues. My current theory is that while
my screen's resolution is 1080 wide, the pixel density affects the media query
for the breakpoint.
2020-04-19 13:05:55 +01:00
William Carroll
74ebb8e869 Set the selectedChord to Nothing when setting a key
This helps us avoid showing a chord from a key that the user did not whitelist.
2020-04-19 00:31:42 +01:00
William Carroll
8620d86fd0 Prune {Select,Deselect}AllKeys actions
Removing more unused code attempting to focus this app's scope.
2020-04-19 00:31:06 +01:00
William Carroll
11b140b6ae Highlight root note of each chord
Refactor the Piano component to highlight the root note of each chord. If this
makes things too easy, I can support this as a preference.

Also:
- Reduced the number of keys that the piano displays and increased the key
  thickness to reclaim the space
- Preferred using Tailwind selectors instead of inline styling where applicable
- Call List.reverse on the keys to ensure that the top-most note is a lower note
  than the bottom-most note

TODO:
- Support showing only the name of the chord and not just the notes that
  comprise that chord
- Rewrite the function that generates the chords for a given range of notes
- Consider supporting a dark mode
2020-04-19 00:21:37 +01:00
William Carroll
c6132ab1d6 Remove horizontal padding
Google Chrome's device preview doesn't resemble what I see when I use my phone
to visit this page.
2020-04-18 20:23:02 +01:00
William Carroll
9e855f7427 Create Overview for Learn Piano Chords
Since I've published this, I should include an Overview page to orient potential
users. This Overview could be better -- as could many things with this app --
but it's a start, and I'm seeking small wins.
2020-04-18 19:51:57 +01:00
William Carroll
f55d2f09f7 Remove duplicate step from README
I mention setting tempo twice... whoops.
2020-04-18 19:50:12 +01:00
William Carroll
6dc48753f5 Prefer "Tap" to "Press"
I'm preferring the verb "tap" to "press".
2020-04-18 19:49:25 +01:00
William Carroll
82ebc0ad19 Debug unresponsive button press for selectKey
Observed problem: Tapping "C major, A minor" key, which LPC sets by default,
does not unset it.

Bug: handleClick passed the relativeMinor Key but the default value in
State.Model is the C Major key. We would toggled b/w [Cmajor] ->
[Cmajor,Aminor], and because toggled checked if either Cmajor or Aminor was
present, it was always true.

Solution: Check relativeMajor to set toggled.
2020-04-18 18:51:23 +01:00