The blog ofJonathan Pepin

Get mouse position on canvas

2017-08-02

A simple one that I want to save here because I keep googling it and copy/pasting. ```javascript const getMousePos = (evt, canvas) => { const rect = canvas.getBoundingClientRect(); return { y: evt.clientY - rect.top, x: evt.clientX - rect.left } }...

On Pointers in Go - Really

2017-07-26

I wrote about pointers in Go in this previous post (/2017/On-Go-Pointers/). And I still banged my head for an hour on something just now. So here's another post, so I really, like REALLY understand to always, ALWAYS use pointers. Unless I...

Analysis Paralysis

2017-07-13

When building software, one of the important thing is having a great vision and build a system that will survive and stay relevent as long as possible. Because of that, before actually starting to write software, there is a long,...

On pointers in Golang

2017-06-03

I'm learning Go, and it's my first typed language, so I might write a few posts about things I learn. In Golang, functions can be passed both pointers and direct references to objects. You can also declare those function on...

Notes from The War Of Art [raw]

2017-04-23

Raw Kindle notes for The War Of Art by Steven Pressfield, Shawn Coyne (http://a.co/4IJLdQa) What keeps us from sitting down is Resistance. Most of us have two lives. The life we live, and the unlived life within us. Between the two...

Notes from Sapiens [raw]

2017-04-21

Strongly recommended. Sapiens - Yuval Noah Harari (https://www.amazon.com/Sapiens-Humankind-Yuval-Noah-Harari-ebook/dp/B00JTCH382/ref=sr_1_1?ie=UTF8&qid=1492774881&sr=8-1&keywords=sapiens) A colt can trot shortly after birth; a kitten leaves its mother to forage on its own when it is just a few weeks old. Human babies are helpless, dependent for many years...

"From Devbootcamp to Uber"

2017-03-14

I hated my job. I had studied finance, but hated it so much that I graduated last of my class. I couldn’t find a job and lost any hope of working on Wall Street. But I loved coding. Every night,...

Closures and Callbacks in Javascript

2017-01-10

A normal function Let's declare the function: javascript var add = function(x, y) { return x + y; }; Now, we can call the function using the variable add javascript > add(2, 3) > 5 If we...

Building Stable Systems

2016-11-12

It is impossible to build a system that is 100% stable, available and bug free. Humans will make mistakes. Machines will break. The internet will go offline. Sometimes you will break things that are under your control, and some other...

From Leader-Follower to Leader-Leader

2016-10-25

I recently read Turn The Ship Around (https://www.amazon.com/Turn-Ship-Around-Turning-Followers/dp/1591846404/ref=sr_1_1?ie=UTF8&qid=1477376801&sr=8-1&keywords=turn+the+ship+around), an incredible book about how to give your team control instead of taking it, and creating leaders instead of followers. Here are my notes. ## What it's all about The main idea is...