Skip to content

Instantly share code, notes, and snippets.

View szaim's full-sized avatar

Sofia Zaim szaim

View GitHub Profile
@szaim
szaim / portfolio_advice.md
Created November 16, 2016 23:03 — forked from olexpono/portfolio_advice.md
Thinkful Portfolio Q&A, Tips & Tricks

Portfolio Advice

These are the take-aways from my Q&A sessions working with students on their portfolios at Thinkful. Hopefully these guidelines will make building a successful portfolio site straightforward.

Recommended contents

Keep it simple! Unless you have a blog, or some other major section to your site, it's likely that you don't even need a navigation. In practice, making a "cool reveal" or an awesome unique style is much better than packing in more pages and more projects. Here are the critical sections.

app.post('/api/card', passport.authenticate('bearer', {
session: false
}),
function(req, res) {
// console.log('categoryId', req.body.categoryId);
Objective.find({
_id: req.body.objectiveId
})
.exec(function(err, objective) {
var newCard = new Card({
BinarySearchTree = function(key, value, parent) {
this.key = key || null;
this.value = value || null;
this.parent = parent || null;
this.left = null;
this.right = null;
};
BinarySearchTree.prototype.insert = function(key, value) {
if (this.key == null) {
//Write an O(n) algorithm to sort an array of integers,
//where you know in advance what the lowest and highest values are.
var myArray = [8, 2, 5, 7, 4, 3, 12, 6, 19, 11, 10, 13, 9];
var swap = function(array, indexa, indexb){
var temp = array[indexa];
array[indexa] = array[indexb];
array[indexb] = temp;
}
@szaim
szaim / W10D2.js
Created September 28, 2016 14:35 — forked from Rosuav/SearchTree.js
//Utility function to display a binary tree to the console
//More helpful than console.log(tree) due to circular parent refs
//Usage: print_tree(some_tree)
function print_tree(tree, depth) {
if (!depth) {
console.log("" + tree.key);
depth = 0;
}
depth += 1;
if (tree.left) {
@szaim
szaim / W10D1.js
Created September 27, 2016 00:21 — forked from Rosuav/W10D1.js
//NOTE: These functions are NOT reliable if there are astral characters
//in the input! Use with UCS-2 strings only.
//Python implementations of the same algorithms for comparison:
// https://gist.github.com/Rosuav/d02bf71f8bb5354327ee8a8e5fb54e3f
//Write an algorithm to check whether any permutation of a string is a
//palindrome (a string which reads the same forwards and backwards).
//Note that this does not use the HashMap class due to a lack of useful
//features such as iteration. The core algorithm would work the same way
var LinkedList = function() {
this.length = 0;
this.head = null;
};
//console.log('*** Created empty Linked List ***');
var myLinkedList = new LinkedList;
//console.log('myLinkedList Object:', myLinkedList);
LinkedList.prototype.insert = function(index, value) {
@szaim
szaim / solution for W9D4.js
Created September 22, 2016 21:54 — forked from mrmojica/solution for W9D4.js
Array - Data Structure / Algorithim
// Imagine you have an array of numbers.
// Write an algorithm to remove
// all numbers less than five from the array.
function removeLessFive(array) {
for(var i = 0; i < array.length; i++) {
if (array[i] < 5 ) {
//2.1 Exercises / Interview Questions
//1. What is 2^5 in binary?
//console.log(Math.pow(2, 5));
// 100000
//2. What is 2^5 - 1 in binary?
/*31 in binary?
31 - 16 = 15
15 - 8 = 7
7 - 4 = 3
//Iterative versions of https://gist.github.com/Rosuav/5736378d02c6cd459470582ce301b4b4
//Exercise 1: Take an integer as input, and return a boolean indicating whether
//the value is even or odd.
//Editorial comment: This isn't even iterative, just fomulaic. Exercise 4 could
//be done similarly. Avoiding iteration AND recursion generally gives the best
//performance, when it's possible (but usually it won't be).
function is_even(int) {
return (int % 2) == 0;
}