Skip to content

Instantly share code, notes, and snippets.

:shipit:

@sleepyfox sleepyfox

:shipit:
Block or report user

Report or block sleepyfox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sleepyfox
sleepyfox / fruit_ninja.md
Created Oct 30, 2019
Fruit Ninja pattern - Monlith to Microservices
View fruit_ninja.md

The Fruit Ninja pattern

In the once popular mobile game 'Fruit Ninja', the player must use their finger like a katana to slice pieces of fruit that fly across the screen to gain points. Sometimes a bomb will replace a piece of fruit, and if the player accidently slices the bomb then they will lose one of their three lives. If you've never played Fruit Ninja before then this video shows the gameplay.

When on the journey from monolith to microservices, it is often the case that we need to slice off a piece of the application into its own service, and the choice and drawing of a seam to cut along is the key to making this approach successful.

Some things to consider:

  • Is the thing a domain entity? (DDD)
  • Does it have a bounded context?
@sleepyfox
sleepyfox / code_of_cthulhu.md
Last active Oct 30, 2019
The Code of Cthulhu
View code_of_cthulhu.md

The code of Cthulu

I did not invent this, I have extensively searched for the original article but failed to find it, so I'll do my best to reproduce it here.

Imagine a large Enterprise software development company. A bright young programmer joins this company, and in their first few weeks sets about the non-trivial task of understanding the gigantic bloated code base for the company's flagship product.

Finally, the young programmer ascends the dizzy spire of the company's office building and storms into the CTO's gloomy office with a stack of fanfold computer printout, pausing as they become aware of the music playing: a cacophany of crazed flutes and pan-pipes emerging from an audiophile system with a turntable that looks like a medieval orrery and a speaker that bears more than a passing resemblance to the monstrous shell of some long-extinct cephalopod. The music stops, the silence replacing it redolent of some awful finality.

Still full of righteous indignation the programmer angrily declares: "

@sleepyfox
sleepyfox / languages.md
Created Sep 26, 2019
Languages I've used
View languages.md

Early days

I learned BASIC, 6502 Assembler, Pascal, 68000 Assembler, Modula-2, MATLAB, Logo, Fortran, DCL, Scheme, Ada, Prolog, CSP, VDM, Occam, HyperScript, Redcode, and the binary language of moisture 'vaporators before I left University.

Professional work

Commercially I've been paid for programming in C, Bash, Hitachi DSP assembler, Make, SQL, PL/SQL, Pro*C, Visual C++, Visual Basic, COBOL, C++, Java, Perl, TCL, Python, Objective-C, Scala, Smalltalk, C#, JavaScript, CoffeeScript, LiveScript, Go, Ruby, LISP (Sibilant) and most recently Clojure.

Just for fun

For fun I've dabbled in Emacs LISP, NewtonScript, Forth, Io, Dart, PureScript, Erlang, Ki, Haskell, Lua, Elixir and Elm.

View jq-cookbook.md

jq cookbook

A series of easy-to-use recipes for helping filter logs et. al. with jq:

Show all logs from production for a service named 'foreboding'

cat swarm.prod/*/*.log | jq select(.service == "foreboding")

View 2019-07-25-users-hate-change.md

'Users hate change'

This week NN Group released a video by Jakob Nielsen in which he attempts to help designers deal with the problem of customers being resistant to their new site/product redesign. The argument goes thusly:

  1. Humans naturally resist change
  2. Your change is for the better
  3. Customers should just get used to it and stop complaining

There's slightly more to it than that, he caveats his argument with requiring you to have of course followed their best practices on product design, and allows for a period of customers being able to elect to continue to use the old site, although he says this is obviously only a temporary solution as you don't want to support both.

View how-many-monkeys.md

How many monkeys do you have?

author: @sleepyfox date: 06-Apr-2011

Preamble: A colleague yammered today that he was off to see OutSystems® tomorrow, and wondered whether we had any comments. For the uninitiated: OutSystems® make a 4GL-style tool called agileplatform™ that reminds me very much of PowerBuilder or Visual Basic from the Good Olde Tymes©.

I've often talked over the past couple of years of the devaluation of the 'Agile' currency, in no small part due to the Scrum Alliance's commercial model and the programme that has been put in place to monetise the Certified ScrumMaster™ title. To quote one well known super-villain[^1]:

I'll sell my inventions so that everyone can have powers. Everyone can be super! And when everyone's super... [chuckles evilly] no one will be!

@sleepyfox
sleepyfox / clojure-exchange-2018.md
Created Dec 7, 2018
A personal review of Clojure eXchange 2018
View clojure-exchange-2018.md

Clojure eXchange 2018

This is a brief overview of the conference, together with notes of what picqued my personal interest. All the videos are up here.

Day 1

Keynote: The spirit of Clojure

Lots of interest for those interested in Clojure for server-side data visualisation, which isn't me. Although the author's contributions to open-source clojure libraries are impressive, the material was very matter-of-fact, and didn't possess the flair or vision that I would expect for a keynote. Bozhidar Batsov's talk about CIDER and the community I think would have made a better keynote.

Polymorphism à la Clojure: Functional Object Oriented Programming is not an Oxymoron.

How to build your own (trivial) object system in Clojure, and what that helps us learn about how Clojure's own object system (borrowed from Java). I sympathise with the presenter's aim, but there was nothing new for me here.

@sleepyfox
sleepyfox / wat-datetime-js.md
Created Dec 7, 2018
Datetime wierdness in JavaScript
View wat-datetime-js.md

The problem with the last fix for the timezone bug was that we constructed a new Date object using

new Date(2010, 0, 1, 0, 0, 0)

which is midnight on the 1st of January 2010 in local time.

Suppose we are trying to construct the date 2019-04-05. If your timezone is UTC+1, it goes something like this:

  1. Construct a new Date(2010, 0, 1, 0, 0, 0)
View callback-hell.js
// An approach based upon event emitters
const EventEmitter = require('events')
const getLargeExternalDataEvent = (url) => {
setTimeout(() => {
console.log('fetching data from ' + url + '...')
q.emit('data', genLongString(url))
@sleepyfox
sleepyfox / test_game.py
Last active Nov 13, 2017
A starting point for the Three Men's Morris game kata in Python
View test_game.py
"A test suite for a Three Men's Morris game"
import unittest
class Game():
def thing(self):
return False
class ThreeMensMorrisTests(unittest.TestCase):
def test_thing(self):
You can’t perform that action at this time.