This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
githubAuthRevoke = function(accessToken) { | |
check(accessToken, String); | |
console.log("in githubAuthRevoke"); | |
let clientId = Meteor.settings.github_clientid | |
let clientSecret = Meteor.settings.github_clientsecret | |
let options = { | |
headers: { | |
'User-Agent': 'CodeBuddies' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BST { | |
constructor(key, value, parent) { | |
this.key = key || null; | |
this.value = value || null; | |
this.parent = parent || null; | |
this.left = null; | |
this.right = null; | |
} | |
insert(key, value, parent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HashMap { | |
constructor(capacity) { | |
this.length = 0; | |
this._slots = []; | |
this.capacity = capacity || 8; | |
this.deleted = 0; | |
}; | |
set(key, value) { | |
const loadRatio = (this.length + this.deleted + 1) / this.capacity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exercise to re-implement a Javascript Array from scratch | |
// We are using a quazi implementation of memory (JS Array) to mimic directly accessing your system memory and simulating a block of memory | |
// const memory = require('./memory'); <=== fake memory using JS Array | |
// Initialize Array object (using ES6 class syntax here) | |
class Array { | |
constructor() { | |
this.length = 0; | |
this._capacity = 0; | |
this.ptr = memory.allocate(this.length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var my_arry = ["hello", "muchasgracias", "hi", "elephant"]; | |
function findShortest(arry) { | |
return arry.reduce(function(prevWord,currWord) { | |
if (currWord.length < prevWord.length) { | |
return currWord; | |
} | |
else | |
return prevWord; | |
}) |