Skip to content

Instantly share code, notes, and snippets.

@cgag
cgag / gist:7a293c6a7c4bd27cef7dcfe3538b7367
Last active September 9, 2018 23:59
zig compiler assertion
const std = @import("std");
const warn = std.debug.warn;
const fmt = std.fmt;
const mem = std.mem;
var alloc = &std.heap.DirectAllocator.init().allocator;
pub const Expr = union(enum) {
Literal: Literal,
};
@cgag
cgag / gist:04e2e921cb54474fcee0a6f20a1e3d98
Last active August 31, 2018 21:20
weird zig segfault
const std = @import("std");
const warn = std.debug.warn;
const fmt = std.fmt;
const mem = std.mem;
var alloc = &std.heap.DirectAllocator.init().allocator;
pub const ExprType = enum {
Binary,
Literal,
const std = @import("std");
const Food = enum {
Pretzel,
Cheese,
Cucumber,
};
pub fn main() !void {
const alloc = &std.heap.DirectAllocator.init().allocator;
### Keybase proof
I hereby claim:
* I am cgag on github.
* I am cgag (https://keybase.io/cgag) on keybase.
* I have a public key ASCdMKp9h-XuWWOZPnlJZar9aXF32-6PMDR26pd-3H86Ygo
To claim this, I am signing this object:
@cgag
cgag / test.zig
Last active September 10, 2017 00:02
ir.cpp err
The initial program I tried to run:
```
pub fn main() -> %void {
var m2 = &2;
%%io.stdout.printf("hello: {}\n", m2);
}
```
error:
@cgag
cgag / richhickey.md
Created June 15, 2016 03:56 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@cgag
cgag / log.go
Created May 22, 2016 19:07 — forked from cespare/log.go
Golang apache logging
type ApacheLogRecord struct {
http.ResponseWriter
ip string
time time.Time
method, uri, protocol string
status int
responseBytes int64
elapsedTime time.Duration
}
@cgag
cgag / gist:8031034
Created December 18, 2013 22:33
nginx and compojure/jetty
102
103 server {
104 listen 80;
105 server_name bookmarking.curtis.io;
106
107 location / {
108 expires 24h;
109 proxy_pass http://localhost:3000/;
110 sendfile on;
111 proxy_redirect off;
...
(defroutes basic-routes
(GET "/" [] (str "<a href=\"/test\">test</a>"))
(GET "/test" [] (friend/authenticated (home/index))))
(defroutes all-routes
basic-routes
<other routes>)
@cgag
cgag / car.cpp
Created February 23, 2013 20:18
class Car {
private:
void top () {
printf(" ________________________");
printf(" / | \\");
printf(" / | \\");
printf(" / | \\");