Skip to content

Instantly share code, notes, and snippets.

View ryanseys's full-sized avatar
🌴

Ryan Seys ryanseys

🌴
View GitHub Profile
@ryanseys
ryanseys / fizzbuzz.rkt
Last active August 29, 2015 13:56
Recursive FizzBuzz in Scheme
#lang racket
(define (fizzbuzz n limit)
(cond
((eq? (modulo n 15) 0)
(printf "~a: FizzBuzz~n" n))
((eq? (modulo n 3) 0)
(printf "~a: Fizz~n" n))
((eq? (modulo n 5) 0)
(printf "~a: Buzz~n" n)))
@ryanseys
ryanseys / update.sh
Created March 15, 2014 20:31
Update/upgrade a bunch of stuff on my system
#!/usr/bin/env sh
gem update
brew update
brew upgrade
upgrade_oh_my_zsh
.heart {
font-size: 200pt;
line-height: 0.9;
text-align: center;
color: red;
-webkit-animation:beat 0.6s infinite; /* Chrome, Safari, Opera */
-moz-animation:beat 0.6s infinite;
animation:beat 0.6s infinite;
}
@ryanseys
ryanseys / increment.js
Last active August 29, 2015 14:03
Increment number represented in Array
/**
* Increment number represented in array
*
* E.g. Take [1, 2, 3] increment to [1, 2, 4]
* @param {[Number]} arr Array to increment
* @return {[Number]} Array of numbers
*/
function increment(arr) {
for(var i = arr.length - 1; i >= 0; i--) {
if(arr[i] === 9) {
@ryanseys
ryanseys / ramanujan.js
Created July 6, 2014 22:28
Finding Ramanujan numbers
/**
* Find all possible sum of cubes for a particular number
* @param {Number} Number to find all sum of cube pairs
* @return {Array} Array of sum of cubes
*/
function findAllPossiblePairs(n) {
var doneFinding = false;
var i = 1;
var found = [];
var j = Math.floor(Math.pow(n, 1/3));
@ryanseys
ryanseys / hello.js
Last active August 29, 2015 14:06
Simple JavaScript module
function hello() {
console.log('hello from a github gist');
}
module.exports = hello;
@ryanseys
ryanseys / format.js
Created September 16, 2014 23:59
util.format
/**
* Format a string with values from the provided object.
*
* @param {string} template - String with {} denoted keys. (See example)
* @param {object} args - Key/value pairs matching the holes in the template.
* @return {string}
*
* @example
* format('This is a {language} ({abbr}) codebase.', {
* language: 'JavaScript',
@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
@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 / 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...'