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
@nathanhornby
nathanhornby / typeform-velocity.js
Created December 4, 2015 11:37
Scroll to active field in form (typeform style animation) using velocity.js
// Insert into some kind of 'focus' action
var parent = $(this).parent().parent('.fieldWrap'); // Target a wrapper
// Reset active state
$('.fieldWrap').removeClass('active');
// Add active state to current field
parent.addClass('active');
@galek
galek / pbr.glsl
Created November 4, 2015 11:10
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
package com.dango_itimi.utils;
import haxe.rtti.Meta;
using com.dango_itimi.utils.MetaUtil;
class MetaField
{
public var name(default, null):String;
public var value(default, null):Array<Dynamic>;
public function new(name:String, value:Array<Dynamic>)
@ruby0x1
ruby0x1 / Main.hx
Last active April 19, 2016 02:14
Prevent the space key from scrolling the page with luxe
import luxe.Input;
class Main extends luxe.Game {
override function config(config:luxe.AppConfig) {
config.web.prevent_default_keys.push(Key.space);
return config;
@KeyMaster-
KeyMaster- / PhysBody.hx
Created April 4, 2015 22:16
Luxe rectangles physics engine (WIP, and very basic)
package ;
import luxe.Component;
import luxe.Rectangle;
import luxe.Vector;
class PhysBody {
public var rect:Rectangle;
public var vel:Vector;
public var acc:Vector;
@chamberlainpi
chamberlainpi / CopyFiles.hx
Last active August 29, 2015 14:18
Copy files in specific or common directory, useful for post-build processes.
package macros;
import sys.FileSystem;
import sys.io.File;
/**
* Can copy files in two ways:
* A) Provide only the first argument, where each elements specifies [sourceFile1, destFile1, sourceFile2, destFile2, ...], or;
* B) Provide a list of files to move (1st argument), and specify a common directory to copy them to;
*
* @usage:
@chamberlainpi
chamberlainpi / BuildCommands.hx
Last active August 29, 2015 14:18
Build several JS scripts in one pass.
package macros;
import haxe.io.Path;
import haxe.Json;
import sys.FileSystem;
import sys.io.File;
/**
* This script finds Haxe-files in a directory and compiles them to individual JS files.
* A JSON file must be supplied to indicate the CWD, outputDir, fileNamePattern to find the files,
* and the compiler-arguments to apply to all files.
@KeyMaster-
KeyMaster- / PlyImporter.hx
Last active August 29, 2015 14:08
Importer for PLY files from Blender into Luxe
package;
import luxe.Mesh;
import haxe.io.StringInput;
import luxe.options.MeshOptions;
import luxe.Vector;
import phoenix.Batcher;
import phoenix.geometry.Geometry;
import PlyParser;
import phoenix.geometry.Vertex;
/**
@mandiwise
mandiwise / Sync gh-pages + master branches
Last active September 28, 2024 09:43
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@deandob
deandob / livestream
Created February 26, 2014 22:31
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);