Skip to content

Instantly share code, notes, and snippets.

@ionox0
ionox0 / card.js
Last active August 29, 2015 13:56
exports.Card = function(suit,rank) {
function constructor() {};
constructor.prototype.getSuit = function() {
return suit; } ;
constructor.prototype.getRank = function() {
return rank; } ;
return new constructor();
@ionox0
ionox0 / asdf
Created February 16, 2014 22:37
sadf
{
"token": "6fa1b4a093968cd87c7e08f2e1dd66882136cf4d"
}
@ionox0
ionox0 / iterative_list_reverse.js
Created March 17, 2014 04:55
Iterative List Reverse
function reverse(list){
var temp = [];
while (list != null){
temp.push(list.head);
list = list.tail;
}
var newList = {
head: temp.shift,
tail:null
}
@ionox0
ionox0 / linked_list_2.js
Created March 19, 2014 07:13
A Java Script Linked List Class!
function LinkedList() {
this._length = 0;
this._head = null;
}
LinkedList.prototype = {
add: function (data){
var node = {
data: data,
@ionox0
ionox0 / list_merge.js
Created March 19, 2014 09:03
list merge for previously sorted JS linked lists. utilizes my Linked List class
function merge(list1, list2){
var output = new LinkedList();
while(list1 != null | list2 != null){
console.log("asdf");
if (!list2){
output.add(list1.value);
list1 = list1.next;
} else if (!list1){
@ionox0
ionox0 / arayToBST.js
Created March 19, 2014 18:59
converts a sorted array to a binary tree
function arrayToBST(list){
function buildTree(list, min, max){
if (min == max){
return {
value: list[max],
left: null,
right: null
};
}
@ionox0
ionox0 / BST_range_search.js
Created March 19, 2014 19:31
searches a binary search tree for a range of values (see my arrayToBST class for testing)
function rangeSearchBST(bst, min, max){
var list = [];
function searchTree(bst, min, max){
if (bst){
searchTree(bst.left, min, max);
if (min<bst.value & bst.value<max){
list.push(bst.value);
}
searchTree(bst.right, min, max);
}
@ionox0
ionox0 / auth.js
Created March 26, 2014 22:30
twitter keys
// config/auth.js
// expose our config directly to our application using module.exports
module.exports = {
'twitterAuth' : {
'consumerKey' : 'M815eSuEjhX0o1SZkvJlng',
'consumerSecret' : '1PSz1RkuE1vN6z6BO2AfCIFFJz6ICONnpARZi8tOyM',
'callbackURL' : 'http://localhost:3000/auth/twitter/callback'
}
@ionox0
ionox0 / breadthFirstSearch.js
Created April 17, 2014 19:29
Breadth First Search
function BFS(node){
var list = [node];
var current = list.shift();
while(current){
console.log(current.data);
var i = 1;
MM:
App.request('get:photos:recent').fetch().done ->
App.vent.trigger 'recentphotos:fetch:success'
effects Show.Controller
App.vent.on 'recentphotos:fetch:success', ->
effectContainer.collection.addEffect('MosaicPhotos')