This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from: | |
// http://readystate4.com/2008/08/17/javascript-argument-unpacking-converting-an-array-into-a-list-of-arguments/ | |
var item1 = ['Jack', '39', 'Panda']; | |
function hi(name, age, type){ | |
console.log('Hi ' + name + '! You are ' + age + ' and a ' + type + '!'); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var l = [1,2,3,4,5,6,7,8,9,10]; | |
while(l.length){ | |
var r = (Math.random()*1000)%l.length; | |
var removed = l.splice(r, 1); | |
console.log('Removed: ' + removed); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{fancyhdr} | |
\setlength{\headheight}{15.2pt} | |
\pagestyle{fancy} | |
\fancyhf{} | |
\rhead{\bfseries\nouppercase\leftmark} | |
\cfoot{\bfseries\thepage} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) tabs to spaces | |
:set tabstop=4 shiftwidth=4 expandtab | |
:retab | |
2) Whitespace found at end of line | |
:%s/^M\+$//g | |
:%s/\s\+$//g | |
NOTE: ^M must be inserted using CTRL-v RETURN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# helpers | |
function branchExists(){ git show-ref --verify --quiet refs/heads/"$1"; } | |
function currentBranch(){ git rev-parse --abbrev-ref HEAD; } | |
function isCurrentBranch() { [ "$(currentBranch)" == "$1" ]; } | |
# colors | |
Color_Off='\e[0m' # Text Reset | |
BWhite='\e[1;37m' # White | |
Red='\e[0;31m' # Red | |
function whitePrompt(){ echo -en "${BWhite}$@${Color_Off}"; read value; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void drawFaceNormals() | |
{ | |
glColor3f(0,0,1); // The colour we will be drawing is white (red = 1, green = 1, blue = 1). | |
vector<vec3> verts = trig.Vertices(); | |
vector<vec3> fnorms = trig.FaceNormals(); | |
vec3 fnorm, pos, from, to; | |
glBegin(GL_LINES); | |
for(int i = 0; i < fnorms.size(); i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var episode = window.location.href.match(/[0-9]{2}/g)[1]; | |
var next = +episode + 1; | |
next = (next+'').length === 1 ? '0'+next : next; | |
window.location.href = window.location.href.replace('e'+episode, 'e'+next); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using first frame for testing | |
Skeleton* frame0 = rest_animation->GetFrame(0); | |
// for each joint in skeleton... | |
for (int i = 0; i < frame0->NumJoints(); i++) { | |
// current joint | |
Joint jnt = frame0->GetJoint(i); | |
// "global" transformation that should be applied to current joint | |
Matrix_4x4 totalTransform = Matrix_4x4::Id(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: var episode = window.location.href.match(/[0-9]{2}/g)[1]; var next = +episode + 1; next = (next+'').length === 1 ? '0'+next : next; window.location.href = window.location.href.replace('e'+episode, 'e'+next); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = 0; | |
E = 1; | |
S = 2; | |
W = 3; | |
% for example a 4x4 grid: | |
policy = [S W W W; | |
S W W N; | |
S N E E; | |
E N W W]; |