Skip to content

Instantly share code, notes, and snippets.

View gregkepler's full-sized avatar

Greg Kepler gregkepler

View GitHub Profile
@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);
@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
@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)
@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?
@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
@geoffreymcgill
geoffreymcgill / index.html
Created January 19, 2015 06:19
Prism with Copy to Clipboard
<!doctype html>
<html>
<head>
<title>Prism Copy to Clipboard sample</title>
<link rel="stylesheet" href="prism.css" type="text/css" media="screen" />
<link rel="stylesheet" href="toolbar.css" type="text/css" media="screen" />
<script type="text/javascript" src="prism.js"></script>
<!-- Adapted from http://dev.misterphilip.com/prism/plugins/toolbar/ -->
@n3dst4
n3dst4 / ConEmu Git Bash.md
Last active July 19, 2022 17:11
My ConEmu / Cmder git bash task config
  1. Open Conemu

  2. Open Settings -> Tasks or go to new tab button -> Setup tasks.

  3. Click + to add a new task

  4. Enter the name as Git Bash or whatever you like

  5. Task parameters:

     /icon "C:\Program Files (x86)\Git\etc\git.ico" /dir "C:\_git"
    
  6. Command:

@lsapan
lsapan / vue-cli-django.md
Last active December 29, 2022 10:47
Using Vue CLI to start a Vue frontend for use with a Django backend

Using Vue CLI to start a Vue frontend for use with a Django backend

Note: This guide has been updated for use with @vue/cli version 4! Please make sure you're using the latest version of @vue/cli.

When it comes to starting new Vue projects, you can't really beat Vue CLI. The Vue team has done a phenomenal job of making an easy-to-use tool for getting started with reasonable defaults. If you're using Django though, you may not have the easiest time getting its static system and webpack to play well together.

A good chunk of this is applicable to any webpack-compiled frontend and Django, but we'll focus specifically on the steps involved with Vue CLI.

As a quick heads up: this tutorial assumes you're creating your Vue project in a folder named frontend inside of your Django project folder. If you want it named something else, or want it in a different folder, just update the paths accordingly.

@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,
@gregkepler
gregkepler / ffmpeg-background-color.bat
Created March 19, 2019 21:08
ffmpeg transparent png background color
ffmpeg -f lavfi -i color=c=black:s=1280x720 -i "C:\path\to\image.png" -shortest -filter_complex "[0:v][1:v]overlay=shortest=1,format=yuv420p[out]" -map "[out]" "C:path\to\output\out.mp4"