Skip to content

Instantly share code, notes, and snippets.

James Prado james-prado

  • Montreal
Block or report user

Report or block james-prado

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
@james-prado
james-prado / quicksort.js
Last active Jan 25, 2017
QuickSort Recursive Function In JavasScript
View quicksort.js
function quickSort(numbers, target, partial) {
var sum, remaining;
var partial = partial || [];
// sum partial
sum = partial.reduce(function (a, b) {
return a + b;
}, 0);
// check if the sum partial equals the target
@james-prado
james-prado / main.py
Created Apr 24, 2017
Project Euler Question 1
View main.py
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
class Multiples:
def __init__(self, num, min, max):
self.__num = num
self.__min = self.round_step(min)
self.__max = max
@james-prado
james-prado / main.py
Created Apr 25, 2017
Project Euler Question 2
View main.py
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
#
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
#
# By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
# Find the sum of the even-valued terms < four million in the Fibonacci sequence
class Fibonacci_numbers:
@james-prado
james-prado / deep_flatten.js
Last active Sep 5, 2018
Deep flatten an array
View deep_flatten.js
const input = [[1, 2, [3]], 4];
// ––––– Option 1 –––––
function baseFlatten(array, depth, result) {
result || (result = []);
if (array == null) {
return result;
}
@james-prado
james-prado / cloudSettings
Created Mar 14, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-03-14T20:52:04.117Z","extensionVersion":"v3.2.4"}
You can’t perform that action at this time.