Skip to content

Instantly share code, notes, and snippets.

View homelinen's full-sized avatar

Calum Gilchrist homelinen

View GitHub Profile
@homelinen
homelinen / movieTransform1.xsd
Created March 29, 2012 21:10
Over the Top XPath Transform
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="actorKey" match="person" use="@aID"/>
<xsl:template match="/">
<html>
<head>
<title>Movies</title>
</head>
<body>
<h1>Profit of Films Starring Jessica Alba</h1>
/**
* Monitors projectiles and whether they should be
* destroyed or not
* @author homelinen
*
*/
public class ProjectileGarbageCollector implements PhysicsCollisionListener{
String worldName;
package Oxyfps;
import com.jme3.input.InputManager;
import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.MouseButtonTrigger;
public class InputController implements ActionListener {
public Vector3f findStartPoint(Vector3f position, float objHeight) {
Vector3f newPos = position.clone();
int center = Math.round(heightMap.getSize() / 2);
Vector3f trans = new Vector3f(center, 0, center);
position.addLocal(trans);
float yHeight = heightMap.getInterpolatedHeight(position.x, position.z) + objHeight;
@homelinen
homelinen / old-lightbox.js
Created June 23, 2012 16:42
Lightbox I'm currently using on my website.
/*
* Title: Lightboxer
*
* AUTHOR:
* Calum Gilchrist - http://CalumGilchrist.com
*
* Description: Creates a simple, light Lightbox for viewing and looking through images, built for Gallerium Image Viewer.
*
* TODO:
* - Make the actual lightboix easier to read, in the code
@homelinen
homelinen / lambda-snippet.tex
Created November 4, 2012 16:17
Lambda Calculus in LaTeX
\begin{eqnarray*}
&& (\lambda xyz.xyz)(\lambda x.xx)(\lambda x.x)x \\
& \to_\beta & (\lambda yz.xyz)[x := \lambda x.xx](\lambda x.x)x \\
& \equiv & (\lambda yz.(\lambda x.xx)yz)(\lambda x.x)x \\
& \to_\beta & (\lambda yz.(xx)[ x := y]z)(\lambda x.x)x \\
& \equiv & (\lambda yz.yyz)(\lambda x.x)x \\
& \to_\beta & (\lambda z.yy)[ y := \lambda x.x ]x \\
& \equiv & (\lambda z.(\lambda x.x)(\lambda x.x)z)x \\
& \to_\beta & (\lambda z.x[x := \lambda x.x]z)x \\
& \equiv & (\lambda z.(\lambda x.x)z)x \\
@homelinen
homelinen / Rakefile
Created November 11, 2012 01:00
My 3D Model Rake File
#!/usr/bin/env rake
# Basic rake file
task :default => [:compile]
libraries = "-lGL -lGLU -lglut -lm"
appName = "initials"
includes = "3DCurve.cpp 3DCube.cpp drawHelpers.cpp letters.c display.c mouse.c keyboardHandler.c legs.cpp LegDefinition.cpp scene.c camera.c spider.c thorax.cpp head.cpp abdomen.cpp"
desc "Compile sources"
@homelinen
homelinen / jsonparser.java
Created November 15, 2012 16:11
Very Simple JSON Parser
import java.io.*;
import java.util.Map;
import static java.nio.file.Files.newBufferedReader;
import static java.nio.file.Paths.get;
import static java.nio.charset.Charset.defaultCharset;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
[
{
"city1": "Aberdeen",
"city2": "Ayr",
"weight": 179
},
{
"city1": "Aberdeen",
"city2": "Edinburgh",
"weight": 129
@homelinen
homelinen / GeneticAlgorithm.java
Created November 21, 2012 20:05
My Genetic Algorithm for AI Coursework
package uk.calumgilchrist.ai.pathfinder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Random;