Skip to content

Instantly share code, notes, and snippets.

View ryanseys's full-sized avatar
🌴

Ryan Seys ryanseys

🌴
View GitHub Profile
@ryanseys
ryanseys / graph.js
Created October 18, 2014 23:37
Graph 💥
function Graph() {
this.nodes = [];
this.edges = [];
};
Graph.prototype.addNode = function(node) {
if(node) {
this.nodes.push(node);
}
};
@ryanseys
ryanseys / googlesort.js
Created October 15, 2014 19:49
Google Sort
function googlesort(a, b) {
var order = ['1', 'S', 'Galaxy', 'Q', '7', '4', '10', '5', '6'];
return order.indexOf(a) > order.indexOf(b);
}
console.log(['10', '6', '5', '4'].sort(googlesort));
// [ '4', '10', '5', '6' ]
@ryanseys
ryanseys / installstuff.sh
Last active October 27, 2015 06:52
Install stuff
#!/bin/bash
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install brew-cask
brew install caskroom/cask/brew-cask
# install homebrew packages
brew install python
@ryanseys
ryanseys / updatestuff.sh
Last active August 29, 2015 14:07
Update stuff
#!/bin/bash
# Homebrew
brew update
brew upgrade
brew cleanup
brew doctor
# Ohmyzsh
upgrade_oh_my_zsh
@ryanseys
ryanseys / gaCheck.js
Created October 3, 2014 16:00
Checking for Google Analytics
var gaObj = window['GoogleAnalyticsObject'];
window[gaObj](function(tracker) {
return tracker.get('clientId');
});
@ryanseys
ryanseys / shadercheck.cpp
Created September 29, 2014 17:01
Check shaders for errors
void checkShaderForErrors(GLuint shaderID) {
// check shader for errors
glGetShaderiv(shaderID, GL_COMPILE_STATUS, &compile_status);
glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &logLength);
logMsg = new GLchar[logLength + 1];
glGetShaderInfoLog(shaderID, logLength, NULL, logMsg);
if (compile_status != GL_TRUE) {
@ryanseys
ryanseys / privileged.js
Created September 27, 2014 19:53
Privileged methods
/**
* Privileged methods.
*
* From http://www.crockford.com/javascript/private.html
*/
function Container(param) {
function dec() {
if (secret > 0) {
secret -= 1;
return true;
@ryanseys
ryanseys / deploy.sh
Created September 27, 2014 19:42
Prepare image for deployment using Dokku
#!/bin/sh
set -e
# Create image for deployment with Dokku
USERNAME=user # this is the user you will use to ssh into the server with
DOMAIN=example.com
echo 'Updating server...'
@ryanseys
ryanseys / assign1part2.cpp
Last active August 29, 2015 14:06
assign1-part2
/**
* Assignment 1 - COMP 4002
*
* Includes:
* Part II: Task 3 and Task 4
* Part III: Colouring bonus - recursive triangle is coloured.
* Part IV: Displacement parameter “dispX”
*
* Single and recursive triangles - with shaders
*
@ryanseys
ryanseys / assign1.cpp
Last active August 29, 2015 14:06
Render triangles in OpenGL
/**
* Assignment 1 - COMP 4002
* Part 1: Task 1 and 2
*
* Single and recursive triangles - no shaders
*
* Ryan Seys - 100817604
*
* Compile on Mac with:
* $ g++ assign1.cpp -o assign -framework OpenGL -framework GLUT && ./assign