Skip to content

Instantly share code, notes, and snippets.

View jleedev's full-sized avatar
🧙‍♀️

Josh Lee jleedev

🧙‍♀️
View GitHub Profile
.class public final enum LShrubbery;
.super Ljava/lang/Enum;
.source "Shrubbery.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/Enum",
"<",
diff --git i/src/scene.cpp w/src/scene.cpp
index 8382ef7..3ef0d1a 100644
--- i/src/scene.cpp
+++ w/src/scene.cpp
@@ -92,6 +92,9 @@ Color Scene::raytrace(const Ray& camera_ray, int level) const {
continue;
float int_distance2 = Ray::makeRay(camera_ray.getOrigin(),
intersection->getOrigin()).getDir().magnitude2();
+ if (int_distance2 < 1e-6)
+ // Too close! We must move forwards a little.
@jleedev
jleedev / say
Created April 8, 2011 20:19 — forked from tensorpudding/say
#!/bin/sh
# A very simplified version of OSX's say, using festival
# Usage: say [words]
if [ $# = 0 ]
then
echo "Usage: `basename $0` [words]"
exit 1
fi
#!/bin/sh
export PAGER=
[ $# -le 1 ] || (echo "Usage: git how [ref]"; exit -1)
[ "$1" ] && ref="$1" || ref=HEAD
old="$ref@{1}"
git rev-parse --short "$old" | tr -d '\n'
printf ..
git rev-parse --short "$ref"
josh@tortuga:~/repo1$ (master) git ls-files -s
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 files
160000 8b2785e26ff50203b827a29a590fc4cf8b91fe10 0 repo2
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 stuff
josh@tortuga:~/repo1$ (master) (cd repo2; git rev-parse HEAD)
8b2785e26ff50203b827a29a590fc4cf8b91fe10
josh@tortuga:~/repo1$ (master) (cd repo2; git commit --allow-empty -m 'Updated repo2')
[master 0224058] Updated repo2
josh@tortuga:~/repo1$ (master) git status
# On branch master
class TumbleDRYer
def initialize filename
@hash = Hash.new 0
@links = Hash.new 0
previous = nil
open(filename).read.scan /\w+|\W+/ do |word|
unless previous.nil?
@links[[previous,word]] += 1
end
@hash[word] += 1
@jleedev
jleedev / gist:994429
Created May 27, 2011 00:46 — forked from kognate/gist:994423
tumbledry
class TumbleDRYer
def initialize filename
@hash = Hash.new 0
@links = Hash.new 0
previous = nil
open(filename).read.scan /\w+|\W+/ do |word|
unless previous.nil?
@links[[previous,word]] += 1
end
@hash[word] += 1
all: main
extern.o: extern.cpp
main.o: main.cpp
main: main.o extern.o
g++ $^ -o $@
#!/bin/sh
export PAGER=
ref=HEAD
old=ORIG_HEAD
git rev-parse --short "$old" | tr -d '\n'
printf ..
git rev-parse --short "$ref"
git diff --stat --summary "$old" "$ref"
import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Either<Integer, String> x;
if (scan.hasNextInt()) {
x = Either.l(scan.nextInt());
} else {
x = Either.r(scan.nextLine());