Skip to content

Instantly share code, notes, and snippets.

Avatar

Gregory Orton ortonomy

View GitHub Profile
@ortonomy
ortonomy / Memoization examples.js
Created Jun 4, 2017
Memoization examples created by ortonomy - https://repl.it/I5EQ/3
View Memoization examples.js
// All ES6 functions
// Used for showing how memoization saves execution cycles
let counter = 0;
// Naive Fibonacci function that calculates every value of a Fibonacci number from 0 every time it's called.
let fibNaive = (n) => {
counter++
console.log("fibNaive call #: " + counter);
return n < 2 ? n : fibNaive(n-1) + fibNaive (n-2);
};
View DirectoryListing.cs
using System;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
public class DirectoryListing:Page
{
protected void WriteTitle()
{
Response.Write("Listing contents of directory");
@ortonomy
ortonomy / gist:9370186
Created Mar 5, 2014
FLMobiGame Week 2 Complete
View gist:9370186
@Override
protected void actionOnTouch(float x, float y) {
mLastX = x;
mLastY = y;
//Increase/decrease the speed of the ball making the ball move towards the touch
mBallSpeedX = ( x - mBallX ) * 2; // will double the speed of the ball
mBallSpeedY = ( y - mBallY ) * 2;
}