Skip to content

Instantly share code, notes, and snippets.

View seansu4you87's full-sized avatar

Sean Yu seansu4you87

  • Evenly
  • San Francisco, CA
View GitHub Profile
@seansu4you87
seansu4you87 / gen_server.rb
Created August 10, 2016 23:09
A naive implementation of gen_server in Ruby, for demonstration purposes.
require "ostruct"
require "securerandom"
module GenServer
class << self
def call(pid, method, *args)
entry = fetch_entry(pid)
value, state = entry.module.send(method, entry.state, *args)
entry.state = state
update_entry(pid, entry)
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module ParserCombinators where
{-
We'll build a set of parser combinators from scratch demonstrating how
they arise as a monad transformer stack. Actually, how they arise as a
choice between two different monad transformer stacks!

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.

Exercises for practice

@seansu4you87
seansu4you87 / geektools-multi-monitor.md
Last active February 17, 2024 04:29
GeekTools Multi Monitor Reposition

Geektools with Varying Monitor Setups

While I love my Geeklets, I had a pretty hard time to set them up consistently across varying monitor setups (home, work, on the go,...). The bad news first: There is no built in mechanism (as of 01/2013) to take care of this problem. Still there are good news: With some minor tinkering, you can automagically position your Geeklets across multiple setups.

The initial step is to add your Geeklets - you can totally ignore the positioning for the moment.

Which Geeklets Am I Running?

-----BEGIN CERTIFICATE-----
MIIFAzCCA+ugAwIBAgIQGLLLuqME8aAPwfLzJkYqSjANBgkqhkiG9w0BAQUFADCB
gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV
BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw
MDBaFw0xOTEyMzEyMzU5NTlaMHIxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVh
dGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9E
TyBDQSBMaW1pdGVkMRgwFgYDVQQDEw9Fc3NlbnRpYWxTU0wgQ0EwggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCt8AiwcsargxIxF3CJhakgEtSYau2A1NHf
5I5ZLdOWIY120j8YC0YZYwvHIPPlC92AGvFaoL0dds23Izp0XmEbdaqb1IX04XiR