Skip to content

Instantly share code, notes, and snippets.

View gregkepler's full-sized avatar

Greg Kepler gregkepler

View GitHub Profile
@shawndumas
shawndumas / .gitconfig
Created August 5, 2013 19:08
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@hiddentao
hiddentao / gist:5946053
Last active November 13, 2018 18:18
Generate overridable getters and setters in Javascript
// see blog post: http://www.hiddentao.com/archives/2013/07/08/generate-overridable-getters-and-setters-in-javascript/
Function.prototype.generateProperty = function(name, options) {
// internal member variable name
var privateName = '__' + name;
options = options || {};
options.get = ('undefined' === typeof options.get ? true : options.get );
options.set = ('undefined' === typeof options.set ? true : options.set );
// pre-initialise the internal variable?
@marek-saji
marek-saji / JSON.safe.js
Created January 17, 2013 09:49
Safe version of JSON.stringify. Discards functions, detects multiple references to same objects and introduces maximum depth.
function safeJSONStringify (input, maxDepth)
{
var output,
refs = [],
refsPaths = [];
maxDepth = maxDepth || 5;
function recursion (input, path, depth)
@neilmendoza
neilmendoza / gist:4512992
Last active June 9, 2023 14:22
Function to return matrix for rotation about an arbitrary axis in GLSL.
mat4 rotationMatrix(vec3 axis, float angle)
{
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
@k33g
k33g / kind.js
Created April 2, 2012 20:29
Re Use Object Model of BackBone
// Just do this : (and include backbone.js)
var Kind = function() {
this.initialize && this.initialize.apply(this, arguments);
};
Kind.extend = Backbone.Model.extend
//Simpler
var Thing = function() {};
Thing.extend = Backbone.Model.extend
@kaievns
kaievns / gist:996893
Created May 28, 2011 14:20
Cubic Bezier function emulator
/**
* Cubic Bezier CSS3 transitions emulator
*
* See this post for more details
* http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html
*
* Copyright (C) 2011 Nikolay Nemshilov
*/
function Bezier(p1,p2,p3,p4) {
// defining the bezier functions in the polynomial form
@onedayitwillmake
onedayitwillmake / gist:905106
Created April 6, 2011 03:56
Cinder drawing a billboard plane
ci::Vec3f mRight, mUp;
_mayaCam.getCamera().getBillboardVectors(&mRight, &mUp);
ci::gl::drawBillboard( ci::Vec3f::zero(), ci::Vec2f(100.0f, 100.0f), 0.0f, mRight, mUp);