This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const expectEqual = std.testing.expectEqual; | |
const print = std.debug.print; | |
/////////////////////////////////////////////////////////////////////////////// | |
// Examples for working with Structs and Arrays of Structs | |
// | |
// This is intended to help me understand when Zig works with an entity as a | |
// pointer, and when it makes a copy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const print = std.debug.print; | |
// The dreaded, "unable to evaluate constant expression" | |
// | |
// I'm having a difficult time understanding when the zig compiler transitions | |
// my code execution from comptime to runtime and I'm pretty sure this is the | |
// root cause of my struggles here. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
when-changed - run a command when a file is changed | |
Usage: when-changed FILE COMMAND... | |
when-changed FILE [FILE ...] -c COMMAND | |
Copyright (c) 2011, Johannes H. Jensen. | |
License: BSD, see LICENSE for more details. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const print = std.debug.print; | |
pub fn Abstract(comptime T: type, comptime R: type) type { | |
return struct { | |
const Self = @This(); | |
impl: *T = T{}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -eo pipefail | |
########################################## | |
# Everytime I need to remove a git submdoule, I wind up on stackoverflow trying to find the incantation. | |
# It seems the latest versions have made it much less painful but anyhow, here's a script that I drop into | |
# my ~/bin folder, chmod to 755 and use for easy, safe-ish git submodule removal. | |
########################################## | |
RED='\033[0;31m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################### | |
# Build script | |
########################################################### | |
PROJECTNAME=aspen | |
ROOTDIR=$(shell git rev-parse --show-toplevel) | |
# make dev-install ARCH=armv7l to get the right version of nodejs | |
# Ubuntu desktop is "x86_64", Raspberry Pi is "armv7l", Nodejs | |
# requires "x86_64" to be "x64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################## | |
# MIT LICENSE | |
# Copyright (C) 2012 Luke Bayes | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Displayable interface { | |
AddChild(c Displayable) | |
ChildAt(index int) Displayable | |
SetParent(p Displayable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require web-server/http | |
web-server/servlet | |
web-server/servlet-env) | |
;; Sign in GET handler | |
(define (sign-in-get req) | |
(response/xexpr | |
`(html (head (title "GET")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
die () { | |
echo >&2 "$@" | |
exit 1 | |
} | |
[ "$#" -eq 3 ] || die "3 arguments required ('find', 'replace', dir), $# provided" | |
MATCH=$1 |
NewerOlder