Skip to content

Instantly share code, notes, and snippets.

View fortytw2's full-sized avatar
🕶️

Ian fortytw2

🕶️
  • Charleston
  • 03:29 (UTC -04:00)
View GitHub Profile
@fortytw2
fortytw2 / main.go
Created November 16, 2015 13:10
Encapsulated, gracefull goroutine shutdown in
package main
import (
"log"
"os"
"os/signal"
"sync"
"syscall"
"time"
)
@fortytw2
fortytw2 / excuses.txt
Last active June 25, 2025 12:00
programming excuses
Actually, that's a feature
Don't worry, that value is only wrong half of the time
Even though it doesn't work, how does it feel?
Everything looks fine my end
How is that possible?
I broke that deliberately to do some testing
I can have a look but there's a lot of if statements in that code!
I can't make that a priority right now
I can't test everything
I couldn't find any examples of how that can be done anywhere else in the project
@fortytw2
fortytw2 / r.sql
Created July 6, 2015 07:57
recursive sql
WITH RECURSIVE cte (id, body, op_id, path, comment_id, depth) AS (
SELECT id,
body,
op_id,
array[id] AS path,
comment_id,
1 AS depth
FROM comments
WHERE comment_id = 0 AND post_id = $1
UNION ALL