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
/** | |
* Add a General Comment to the Mongo reporting collection | |
* Goal: Should be of similar nature to /webapp/../java/../pages/UserReport.java | |
* Accepts: email | |
* subject | |
url | |
comment | |
sig | |
tag | |
*/ |
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
select first_name, last_name, last_sign_in_at, days_taken, days_total, days_taken / days_total as performance | |
from( | |
SELECT tmp.user_id, sum( days_taken ) as days_taken, sum( days_total ) as days_total | |
FROM account_user | |
inner join account_institution on account_institution.account_id = account_user.account_id | |
inner join courses_institutions on courses_institutions.institution_id = account_institution.institution_id | |
left outer join ( | |
SELECT courses_users.user_id, courses_users.course_id, count(*)::decimal as days_taken, courses_users.role, | |
( | |
SELECT count(*)::decimal |
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
/** Find the number of occurances of a substring within another string, occurances do not need to be | |
* in immediate sequence. for example the pattern ab will match with (a)(b)xcy(a)z(b) for an answer of 3 | |
* | |
*/ | |
var strPos = function( string, substring ){ | |
var count = 0; | |
if( substring.length > 0 ){ | |
var pos = 0; | |
string.split('').forEach(function(character){ | |
pos += 1; |
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
/** | |
# Given an array that represents **individual rolls** of a player in a game bolwing, | |
# write an algorithm to score the game. | |
# | |
# Example: | |
# | |
# Note: each score is a roll | |
# scores = [10,7,3,7,2,9,1,10,10,10,2,3,6,0,7,3,3] | |
# max = 22 rolls (10 frames + last spare -> bonus roll) | |
# spare score == 110 |
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
const denomizations = [ .01, .05, .1, .25, .5, 1.0 ]; | |
const input = .75; | |
function returnLeastChange(input = 0, change = {}, denomizations = []){ | |
let pointer = 0; | |
const toReturn = {}; | |
let newInput = input; | |
while(pointer < denomizations.length - 1){ | |
const x = denomizations[pointer]; | |
if(x <= newInput ){ |
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
// Timed response to problem: | |
// https://drive.google.com/file/d/0B4I3zDNqwzpCZ1BmbTN6TEJxTGVYZWV5WEtTR3BmZ08zdlF3/view | |
// time taken: 8 minutes. | |
let strings = [ | |
'hello world', | |
'{} ', | |
'{{{foo();}}}{} ', | |
'{{}{}} ', |
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
/*(Print an array) Write a recursive method that display all the | |
elements in an array of intergers, separated by spaces. */ | |
#include<iostream> | |
#include<string> | |
using namespace std; | |
string recursiveJoin(int arr[], string seperator, int size, int index=0) | |
{ | |
if (index == size - 1) { |