Skip to content

Instantly share code, notes, and snippets.

View solomon-b's full-sized avatar

Solomon solomon-b

View GitHub Profile
/Library/Ruby/Site/1.8/rubygems.rb:232:in `activate': undefined method `map' for nil:NilClass (NoMethodError)
from /Library/Ruby/Site/1.8/rubygems.rb:258:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:257:in `each'
from /Library/Ruby/Site/1.8/rubygems.rb:257:in `activate'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:33:in `require'
from /Users/solomon/Documents/programming/portfolio sites/lorrainelubner/vendor/rails/activerecord/lib/active_record.rb:29
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:267:in `require_frameworks'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:267:in `each'
#!/usr/bin/env python
"""
Class based AVL balanced binary search tree.
Based on designs from:
https://interactivepython.org/runestone/static/pythonds/Trees/AVLTreeImplementation.html
http://www.geeksforgeeks.org/avl-tree-set-2-deletion/
A tree constists of a single AVL_Tree object and
many Node objects.
#!/usr/bin/env python
import time
"""
Utility Functions and decorators for internal use
"""
def timeit(method):
def timed(*args, **kw):
ts = time.time()
#!/usr/bin/env python
from itertools import chain
"""
Conways Game of Life
From Jack Diederich's Presentation "Stop Writing Classes"
https://www.youtube.com/watch?v=o9pEzgHorH0
"""
module Peano where
import Test.QuickCheck
import Data.Monoid
-- p = 1 + p
data Peano = Zero | Succ Peano deriving Show
--------------------
---- Operations ----
@solomon-b
solomon-b / morra.hs
Last active November 23, 2018 23:05
import Control.Monad
import Control.Monad.Trans
import Control.Monad.Trans.State
import Safe (readMay)
import System.Exit
import System.Random
-------------
--- Types ---
{-# LANGUAGE
DeriveGeneric
, DeriveDataTypeable
, DeriveFunctor
, ScopedTypeVariables
, StandaloneDeriving
, UndecidableInstances #-}
module RecursionSchemes where
import Data.List
mainLoop :: Connection -> Socket -> Endpoint -> IO ()
mainLoop dbConn sock endpoint = do
(sock', _) <- accept sock
putStrLn "Got connection, handling query"
case endpoint of
Fingerd -> handleQuery dbConn sock' >> mainLoop dbConn sock Fingerd
Controld -> handleControlQuery dbConn sock' >> mainLoop dbConn sock Controld
fingerd :: Integer -> IO ()
fingerd port = do

Whodunnit

Victor has been murdered, and Art, Bob, and Carl are suspects. Art says he did not do it. He says that Bob was the victim's friend but that Carl hated the victim. Bob says he was out of town the day of the murder, and besides he didn't even know the guy. Carl says he is innocent and he saw Art and Bob with the victim just before the murder. Assuming that everyone - except possibly for the murderer - is telling the truth, encode the facts of the case so that you can use the tools of Propositional Logic to convince people that Bob killed Victor.

@solomon-b
solomon-b / bananas-notes.hs
Last active January 23, 2019 18:11
Notes from Bananas, Lenses, Envelopes, and Barbed Wire. Will clean these notes up at some point. The Haskell Implementation is a old. Refer to this version: https://gist.github.com/ssbothwell/5464663d1c111de0e49342ae6ea12309
{-# Language
FlexibleContexts,
UndecidableInstances,
TypeSynonymInstances,
DeriveGeneric,
DeriveDataTypeable,
DeriveFunctor,
StandaloneDeriving,
ScopedTypeVariables,
TypeFamilies #-}