Skip to content

Instantly share code, notes, and snippets.

View zhaohansprt's full-sized avatar
🏠
Working from home

zhaohansprt

🏠
Working from home
View GitHub Profile
@schmohlio
schmohlio / sse.go
Last active August 21, 2024 05:00 — forked from ismasan/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
@ijt
ijt / logging_example.hs
Created June 29, 2011 03:10
Example of logging in Haskell
#!/usr/bin/env runhaskell
-- This example uses the hslogger library.
-- For debugging it may be more convenient to use Debug.Trace instead since that
-- allows you to log debugging output from otherwise pure functions.
import System.IO (stderr, Handle)
import System.Log.Logger (rootLoggerName, setHandlers, updateGlobalLogger,
Priority(INFO), Priority(WARNING), infoM, debugM,
warningM, errorM, setLevel)