Skip to content

Instantly share code, notes, and snippets.

Jamis Buck jamis

Block or report user

Report or block jamis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jamis
jamis / sphere-sphere.c
Created Dec 28, 2018
Sphere of spheres, stress test for my ray tracer from "The Ray Tracer Challenge" (C implementation)
View sphere-sphere.c
#include <stdio.h> /* file */
#include <stdlib.h> /* free */
#include <math.h> /* M_PI, cos, sin */
#include <limits.h> /* INT_MAX */
#include "rtc/camera.h"
#include "rtc/shapes/shape.h"
#include "rtc/shapes/sphere.h"
#include "rtc/shapes/group.h"
#include "rtc/shapes/plane.h"
@jamis
jamis / rotkohl.txt
Created Feb 7, 2018
Basic Rotkohl Recipe
View rotkohl.txt
Rotkohl is a traditional German dish made primarily of red cabbage.
My father developed a taste for it in the 1970's, when he lived in Germany
for two years, and I've been trying to find a good recipe for it for
a couple years now. Simultaneously, my dad's diet has become quite
restrictive: no oils, no sugar, etc, and all of the rotkohl recipes I've
found online include both.
The following recipe is one that I've adapted from several sources, and
it is made entirely without sugar or oil (or any of the other bells and
whistles that you'll find in other recipes). The most amazing part is that
@jamis
jamis / 000-notes.md
Created Feb 24, 2017
Source files for Jamis' "designing for tests" presentation at AtomicJolt
View 000-notes.md

Let's talk about testing.

002-calc

  • Simple recursive-descent parser
  • Abstract Syntax Tree (AST) with three node types (Binary, Unary, Atom)
  • #evaluate is the only public API on Calc
    • parses the input
    • evaluates the AST
@jamis
jamis / 000-_init.rb
Last active Mar 1, 2017
Source files from a presentation to AtomicJolt about wrapping a general API (Nokogiri) with a domain specific API
View 000-_init.rb
# rubocop:disable Style/SingleLineMethods
require 'nokogiri'
class Object; alias try send; end
class NilClass; def try(*); nil; end; end
@jamis
jamis / change-x-for-y.rb
Created Mar 12, 2016
A script for searching a dictionary file for words that are relatable via a simple text substitution
View change-x-for-y.rb
# Inspired by a church billboard that read:
# "When I becomes we, illness becomes welness"
#
# usage:
# > ruby change-x-for-y.rb i we
# illness wellness
# inch wench
# it wet
# ...
@jamis
jamis / Whole Wheat Bread Recipe.txt
Last active Mar 19, 2019
Jamis' recipe for homemade whole wheat bread
View Whole Wheat Bread Recipe.txt
Jamis' Whole Wheat Bread
Ingredients
(Pardon the mixed metric/imperial units. I'm a product of my time.)
450 g warm water
450 g milk
1 tbl apple cider vinegar
1 tbl shortening
@jamis
jamis / upsilon.rb
Created Nov 28, 2015
Implementation of an upsilon grid (tiled octagons & squares) and corresponding maze.
View upsilon.rb
require 'chunky_png'
class Cell
attr_reader :row, :col
def initialize(row, col)
@row, @col = row, col
@links = {}
end
@jamis
jamis / torus-grid.rb
Last active Oct 17, 2017
Generate and display a toroidal grid (adaptively subdivided to reduce distortion).
View torus-grid.rb
require 'chunky_png'
class ToroidalGrid
class Cell
attr_reader :row, :column
attr_reader :north, :south
attr_accessor :east, :west
def initialize(row, column)
@row, @column = row, column
@jamis
jamis / mater_matcher.rb
Created Oct 20, 2015
Mater does Rspec: `expect.to not_to`
View mater_matcher.rb
RSpec::Matchers.define :not_to do
match { |actual| !actual }
end
RSpec.describe "Mater" do
specify "says `to not to' to mean false" do
expect(false).to not_to
expect(true).not_to not_to
end
end
@jamis
jamis / benchmark-dup.rb
Created Sep 26, 2015
Compare Array#dup on 1D array, versus Marshal.load(Marshal.dump(...)) on 2D array
View benchmark-dup.rb
require 'benchmark'
N = 100_000
SIZE = 10
array_1d = Array.new(SIZE * SIZE, 0)
array_2d = Array.new(SIZE) { Array.new(SIZE, 0) }
Benchmark.bm do |bm|
bm.report("1d.dup") { N.times { array_1d.dup } }
You can’t perform that action at this time.