Skip to content

Instantly share code, notes, and snippets.

Brad notsoluckycharm

Block or report user

Report or block notsoluckycharm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@notsoluckycharm
notsoluckycharm / app.cpp
Created Feb 28, 2020
recursive array join by seperator
View app.cpp
/*(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) {
@notsoluckycharm
notsoluckycharm / beeswax.js
Last active Mar 30, 2018
Beeswax code challenge
View beeswax.js
// Timed response to problem:
// https://drive.google.com/file/d/0B4I3zDNqwzpCZ1BmbTN6TEJxTGVYZWV5WEtTR3BmZ08zdlF3/view
// time taken: 8 minutes.
let strings = [
'hello world',
'{} ',
'{{{foo();}}}{} ',
'{{}{}} ',
@notsoluckycharm
notsoluckycharm / coin_machine.js
Created Mar 7, 2018
Given an input, return the least change possible
View coin_machine.js
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 ){
@notsoluckycharm
notsoluckycharm / index.js
Last active Feb 26, 2018
CodeCademy Bowling
View index.js
/**
# 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
View strPos.js
/** 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;
@notsoluckycharm
notsoluckycharm / gist:56b414cd3c458a7355e8
Last active Aug 29, 2015
Retrieve Attendance Taken As a Percentage ( times taken / time should have taken ) For All Courses Taught At Schools Associated With A Specific Account For The Entire Year
View gist:56b414cd3c458a7355e8
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
View gist:1093850
/**
* 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
*/
You can’t perform that action at this time.