Before you go, check out these stories!

Hackernoon logoEmbed Github Gists in your Hacker Noon Stories by@RichardJohnn

Embed Github Gists in your Hacker Noon Stories

Author profile picture


humanoid developer at Hacker Noon

The Hacker Noon editor now supports embedding Github gists.

Pasting in the URL such as
and hitting enter will embed the gist into your Hacker Noon story. You'll see something like this:

So we've got that going for us, which looks pretty nice. So go ahead and give it a whirl. Make yourself a Github gist and tell us about it.

For example, I'll tell the curious about the example gist I created one day when I had no job and I was playing around with all sorts of fun code. This gist is a bit of code I wrote to play something called the chaos game, which in its simplest form, plays out like:

  1. Pick some 'anchor' points (like the vertices of a regular polygon)
  2. Pick one of these vertices and another random point anywhere else.
  3. Draw the midpoint
  4. goto 2

Eventually you will see some interesting fractal sort of patterns emerge, which is pretty darn surprising if this isn't something you have heard of before. Picking the vertices of an equilateral triangle and drawing the midpoint gets you a famous pattern, the Sierpinski triangle:

How do you create something so beautiful and structured from seemingly random points?

Nothing in Nature is random... A thing appears random only through the incompleteness of our knowledge.

- Spinoza

The gist of it, is that even though the points are random and the first dot you draw may not be part of the emergent pattern, after the first point, you really cannot escape the domain of this sort of fractal pattern. It really is deterministic and the reason is a bit over my head to be honest, as I only have a curiosity in mathematics, but my education is a bit rusty. Instead, I prefer to play around and experiment.

Below is a CodePen I encourage you to visit and fork and edit to fiddle with the parameters n and r and see what comes of it. You can also click 'Rerun' in the bottom right corner of it to see it start from the beginning, using n = 5 and r = 2. Watching these things appear before your eyes is a pretty amazing experience, in my opinion.

It's worth noting that not all parameters will lead to a fractal pattern. Some will lead to noise without structure.

I first found out about the chaos game via Numberphile on YouTube:

So to conclude, I hope you had fun and I look forward to seeing your code in lovely GitHub gists, showcasing your experiments and new-found knowledge.


Become a Hackolyte

Level up your reading game by joining Hacker Noon now!