Skip to content

Instantly share code, notes, and snippets.

View grantmwilliams's full-sized avatar

Grant Williams grantmwilliams

View GitHub Profile
@lobre
lobre / zig_type_system.md
Last active May 11, 2024 07:40
Zig type system illustrated using ascii diagrams

Zig Type System

Zig aims to be a simple language. It is not easy to define what simple exactly means, but zig is also a low-level programming language that aims for c-compatibility. To reach this goal, it needs good semantics in its type system so that developers have a complete toolbox to manipulate data.

So types in zig are composable, but this can become rapidly overwhelming. See those examples. Are you able to understand them at a glance, as soon as you read them?

*const ?u8
?*const u8
*const [2]u8
@VarunVats9
VarunVats9 / ConsumerTask.java
Last active April 15, 2024 02:44
Count Min Sketch
import java.util.concurrent.BlockingQueue;
public class ConsumerTask implements Runnable {
private static final int H1 = 0;
private static final int H2 = 1;
private static final int H3 = 2;
private static final int H4 = 3;
final static int LIMIT = 100;
@jdegoes
jdegoes / fpmax.scala
Created July 13, 2018 03:18
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
#!/usr/bin/env python
'''Crop an image to just the portions containing text.
Usage:
./crop_morphology.py path/to/image.jpg
This will place the cropped image in path/to/image.crop.png.
For details on the methodology, see
@sunloverz
sunloverz / fifteen_puzzle
Last active August 20, 2020 12:47
fifteen puzzle game
#include <iostream>
#include <iterator>
#include <functional>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <sstream>
#include <string>