Skip to content

Instantly share code, notes, and snippets.

View hamaluik's full-sized avatar
👋
I may be slow to respond.

Kenton Hamaluik hamaluik

👋
I may be slow to respond.
View GitHub Profile
@hamaluik
hamaluik / snowkit.sh
Last active December 7, 2015 06:28
Setup snowkit
#!/bin/sh
haxelib git flow https://github.com/underscorediscovery/flow.git
haxelib git snow https://github.com/underscorediscovery/snow.git
haxelib git luxe https://github.com/underscorediscovery/luxe.git
haxelib git mint https://github.com/underscorediscovery/mint.git
wget http://build.luxeengine.com/snow/latest.all.zip
@hamaluik
hamaluik / PID.cs
Last active November 19, 2015 16:51
class PID
{
public double KP { get; set; }
public double KI { get; set; }
public double KD { get; set; }
public double SetPoint { get; set; }
public double MinSet { get; set; }
public double MaxSet { get; set; }
@hamaluik
hamaluik / qaxisangle.m
Created November 6, 2015 22:30
Matlab Quaternion Functions
function [ result ] = qaxisangle( axis, ang )
%QAXISANGLE Generates a quaternion which rotates by ang around axis
% some helpers
c = cos(ang / 2);
s = sin(ang / 2);
axis = axis ./ norm(axis);
result = [
c,
@hamaluik
hamaluik / minify.js
Created October 27, 2015 01:36
Flow hook to minify the resulting javascript code (stores it in {{app.name}}.min.js).
// ./hooks/minify.js
var UglifyJS = require("uglify-js"); // run "npm install uglify-js" in the hooks directory first!
var fs = require('fs');
exports.hook = function(flow, done) {
var basePath = flow.project.project.app.output + '/web/' + flow.project.project.app.name;
var result = UglifyJS.minify(basePath + '.js', {
mangle: true // set to false if you run into issues
});
fs.writeFile(basePath + '.min.js', result.code, function(err) {
#!/bin/sh
# make sure the behaviour works
haxe test.hxml
exit
@hamaluik
hamaluik / tusk post-commit
Last active October 16, 2015 23:52
Git hook for updating the version file
#!/bin/sh
# find node
NODE=$(which node)
# get the latest commit
COMMIT=$(git rev-parse HEAD)
# if it cannot find a node installation
if [[ -z $NODE ]]; then
@hamaluik
hamaluik / .gitconfig
Created October 8, 2015 17:42
GIt config aliases
[alias]
history = log --pretty=format:'%C(cyan)%h%Cred%d %Creset%s%Cgreen [%cn] %C(blue)(%cr)' --decorate
@hamaluik
hamaluik / flatshaded_frag.glsl
Created August 13, 2015 07:01
Flatshading GLSL Example
#extension GL_OES_standard_derivatives : enable
precision highp float;
precision highp int;
varying vec3 vViewPos;
vec3 normals_1_0(vec3 pos) {
vec3 fdx = dFdx(pos);
vec3 fdy = dFdy(pos);
return normalize(cross(fdx, fdy));
@hamaluik
hamaluik / ScreenSpaceZoom.hx
Last active August 29, 2015 14:19
This will keep sprites in the same position on the screen no matter the zoom. Demo: http://luxe.blazingmammothgames.com/screenspacezoom
// demoed at: http://luxe.blazingmammothgames.com/screenspacezoom
import luxe.Color;
import luxe.Input;
import luxe.Sprite;
import luxe.Vector;
import phoenix.Batcher;
import luxe.Camera;
class Main extends luxe.Game {
var worldSprite:Sprite;
@hamaluik
hamaluik / StaticTilemap.hx
Last active August 29, 2015 14:19
StaticTilemap.hx
import luxe.importers.tiled.TiledMap;
import luxe.options.TilemapOptions;
import luxe.tilemaps.Ortho;
import luxe.tilemaps.Tilemap;
import phoenix.geometry.Geometry;
import phoenix.geometry.QuadPackGeometry;
import phoenix.Rectangle;
import phoenix.Texture;
import phoenix.Vector;