Skip to content

Instantly share code, notes, and snippets.

View TheIronDev's full-sized avatar

Tyler Stark TheIronDev

View GitHub Profile
@TheIronDev
TheIronDev / BinarySearchTree.js
Last active December 23, 2015 07:59
BinarySearchTree Test
var Node = function(value) {
this.value = value;
this.left = null;
this.right = null;
return this;
};
Node.prototype.insert = function(newNode) {
if(newNode.value < this.value) {
if(this.left === null) {
@TheIronDev
TheIronDev / LinkedList.js
Last active December 23, 2015 07:59
Linked List Algorithm tests
var Node = function(value) {
this.value = value;
this.next=null;
return this;
};
var LinkedList = function(node){
this.head = node;
return this;
};
@TheIronDev
TheIronDev / QuicksortArray.js
Created September 25, 2013 02:25
Having some fun with JavaScript. Quicksort implementation for javascript arrays
// Helper Constructor
var RandomArray = function(size) {
size = size || 10;
var tempArray = [];
for(var count=0,max = size;count<max;count++) {
tempArray.push(~~(Math.random()*100));
}
return tempArray;
};
@TheIronDev
TheIronDev / MergesortArray.js
Last active December 23, 2015 21:19
Following quicksort, I made an implementation of mergesort. :)
var RandomArray = function(size) {
size = size || 10;
var tempArray = [];
for(var count=0,max = size;count<max;count++) {
tempArray.push(~~(Math.random()*100));
}
return tempArray;
};
// Check to see if the array is sorted
@TheIronDev
TheIronDev / er1c1996's parsed results.json
Created January 7, 2014 07:57
er1c1996's parsed results
[
{
"pokemonId":"446",
"pokemonNickname":"",
"trainerCountry":"US",
"trainerName":"Josh",
"trainerId":50549,
"level":1,
"isShiny":"FALSE",
"hasHiddenAbility":"FALSE",
/**
* To Execute, run: node isPrime 13
*
*/
var testNumber = process.argv[2];
/**
* @param test - an integer between 1 and 2^16
* If the number is negative, we will absolute value it.
@TheIronDev
TheIronDev / indexroute_doing_too_much
Created January 2, 2015 01:57
Does this guy load too much?
App.IndexRoute = Ember.Route.extend({
model: function() {
var store = this.store;
return Ember.RSVP.hash({
pokeballs: App.Pokeball.all(),
pokemon: store.find('pokemon'),
status: App.Status.all(),
levels: App.Levels
});
@TheIronDev
TheIronDev / mocks.post.js
Last active August 29, 2015 14:13
A dummy in-memory store mock ember-cli example
module.exports = function(app) {
var express = require('express');
var postsRouter = express.Router();
var posts = [],
count = 1;
postsRouter.get('/', function(req, res) {
res.send({
'posts': posts
@TheIronDev
TheIronDev / BST.js
Created February 15, 2015 08:58
Quick BST Implementation
var BST = function(arr){
var length = arr.length,
middle = length % 2 === 0 ? length/2 : (length -1)/2;
this.value = arr[middle];
if(length > 1) {
this.left = new BST(arr.slice(0, middle ));
this.right = new BST(arr.slice((middle + 1), length));
}
}
@@ -61,6 +61,9 @@ module.exports = React.createClass({
},
getInitialState() {
+
+ let previousTransactions = localStorage.previousTransactions ? JSON.parse(localStorage.previousTransactions) : [];
+
return {
// Server-Side calls will populate these