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
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 |
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
var fs = require("fs"); | |
/** | |
* Call fileHandler with the file name and file Stat for each file found inside | |
* of the provided directory. | |
* | |
* Call the optionally provided completeHandler with an array of files (mingled | |
* with directories) and an array of Stat objects (one for each of the found | |
* files. | |
* |
NewerOlder