Skip to content

Instantly share code, notes, and snippets.

@nicl
nicl / mobile-example.go
Created May 25, 2022 14:08
Example of channels, etc.
package main
import (
"context"
"fmt"
"math/rand"
"time"
)
// Pretend we are finding tokens from the db and stream them over a channel.
@nicl
nicl / main.go
Last active May 11, 2022 13:10
Exploration of processing writes with batching, throttling, and a global timeout
package main
import (
"fmt"
"time"
)
/* The requirements are:
1. process the list in batches
2. take into account unprocessed items in the dynamo response
@nicl
nicl / branching.md
Last active August 26, 2020 16:38
Discussion on branching in DCR

Git commands sufficient for 99.9% of the time:

git status
git add -A
git branch
git checkout [-b]
git rebase [-i] master // interactive rebase is amazing
git reset HEAD [file] // when I accidentally add something
git reset HEAD^1 // for when you accidentally commit on master
select
talk_node.nid as id,
talk_meta.title as title,
node__field_talk_description.field_talk_description_value as description,
speaker_meta.title as author,
talk_meta.created as timestamp,
DATE_FORMAT(FROM_UNIXTIME(talk_meta.created), '%d/%m/%y') as date
from
node as talk_node,
node as speaker_node,
@nicl
nicl / branching.md
Last active July 16, 2018 09:54
Branching thoughts

If you were to draw your code flow as a graph, what would it look like?

It's a useful question I've found in discerning what a good and bad architecture looks like.

Consider, the following two cases:

1)  /\

/ \

@nicl
nicl / scala-good-parts.md
Last active September 17, 2020 08:58
Scala - the good parts
@nicl
nicl / HigherOrLower.scala
Created July 5, 2017 16:09
Example higher or lower
import scala.util.Random
trait Guess
case object Higher extends Guess
case object Lower extends Guess
val deck = 1 to 10
def shuffle(decks: Seq[Seq[Int]]): Seq[Int] = {
val shuffled = Random.shuffle(decks.flatten)
@nicl
nicl / age.py
Created October 27, 2016 11:17
print 40
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Top Secret stack",
"Parameters": {
"Name": {
"Description": "Name of the service",
"Type": "String"
},