CGI Scripts in Common Lisp
I've been playing around with CGI (Common Gateway Interface) scripts recently, and reading a bit about Lisp. Having written some Clojure, Racket, and Chicken Scheme, but never any Common Lisp, I thought it would be fun to make a little CGI script in Common Lisp - specifically Steel Bank Common Lisp (SBCL).
A CGI script is a program that a web server calls to handle a request. The program takes the request's body in its stdin, and some of the headers and the query string are available to it through environment variables. The stdout of the program is then sent back as the response to the client.
Continue reading →Powered by Cryogen & Clojure
This blog was built using Cryogen Static Site Generator, which is written in Clojure. Cryogen is extended and configured using Clojure and Clojure's EDN (Extensible Data Notation).
Check out Clojure and Cryogen, if you haven't already!
stdout is only for a program's main output
- Not for any other information
- Not for progress bars
- Not for warnings
- Not for errors
Only for the main output.
Continue reading →The biggest reason I never use classes in JavaScript
JavaScript methods that use this
in reference to the class they belong to will break if the method is assigned to another value or passed into another function as a function object.
This is because the value of this
is dependent on the object that the method is a member of at the time of calling.
Writing Production Ready Code
Is your code too clear and simple? Is it too obvious what it does? Did you write it in a way that is too easy to understand?
If so, you need to make it Production Ready. If you aren't using Factories, Generic Higher Order Functions, or DependencyInversionDeinverterWrapperBeanSingletonProducers, you really need to up your game.
Continue reading →Disproportionately Satisfying Programs
I find some little programs/scripts/snippets disproportionately satisfying to write/use. The best programs are ones that I never intend to share with anyone else.
The following program is one I wrote recently that falls into this category. All it does is convert lines of CSS into React inline styles, and it took only a few minutes to write.
Continue reading →What does your FizzBuzz say about you?
A classic problem
At the interview for my first job, I was asked to write a FizzBuzz. A FizzBuzz is a program that prints a series of numbers, unless a number is divisible by 3, in which case it prints Fizz, or divisible by 5, in which case it prints Buzz. For any numbers divisible by both, it should print FizzBuzz.
Continue reading →Little Red Flags
Obvious issues can betray the presence of subtler ones
Recently, I stayed in an Airbnb. At this Airbnb, the shower's hot and cold were reversed. Initially confusing, but once I realised this I could use the shower with no issues.
Continue reading →