Skip to content

Instantly share code, notes, and snippets.

View aldraco's full-sized avatar

Ashley Drake aldraco

View GitHub Profile
@aldraco
aldraco / workout_at_home.md
Created March 16, 2020 16:57
At-home workouts

Work out at home

Kettlebell

  1. Kettlebell circuit

3 rounds:

  • goblet squat x 10
  • 1 arm row x 8 (each side)
  • 1 arm press x 8 (each)
@aldraco
aldraco / ducks.py
Last active September 5, 2019 21:21
Ducks, quack!
# First, let's define what will end up being our "super class."
class Duck():
def __init__(self, name=None):
self.name = name
def quack(self):
print("QUACK! My name is {}.".format(self.name))
# all ducks can quack, and can say their name.
ducky = Duck("Ducky")
ducky.quack()
{
"action": "pageview",
"apikey": "mashable.com",
"campaign_id": "facebook",
"display": true,
"display_avail_height": 735,
"display_avail_width": 1280,
"display_pixel_depth": 24,
"display_total_height": 800,
"display_total_width": 1280,
@aldraco
aldraco / gist:8864ee2566b487624b00
Created October 1, 2015 20:40
compare points problem on codeeval
import sys
test_cases = open(sys.argv[1], 'r')
def north_south(src, dest):
if src > dest:
return "S"
elif src < dest:
return "N"
else:
@aldraco
aldraco / gist:15236a4dfaf76e866fc0
Created September 28, 2015 16:28
Learning Python - class for Rational numbers, inspired by interactivepython.org's exercises.
def gcd(m,n):
while m % n != 0:
oldm = m
oldn = n
m = oldn
n = oldm % oldn
return n
class Rational:
def __init__(self, n, d):
@aldraco
aldraco / Kandane.js
Created August 20, 2015 12:30
Greedy max subarray algorithm (Kandane)
function Kandane(arr) {
// tracking the best (best sum, best index) possible indexes to get the highest list
// must be contiguous so we only update the indexes and max sum when we find a higher list
// otherwise, we track the potential (current) until it beats the best
var current_sum = 0,
best_sum = 0,
current_index = -1,
best_start = -1,
best_end = -1;
var len = arr.length;
@aldraco
aldraco / makeChange.js
Created August 20, 2015 11:33
Interview Cake and Hackerrank bottom-up recursion problem: making change
// @N is the amount you are making change for
// @coins is the set of coin values you can use
function makeChange(N, coins) {
// initialize the 'ways' array
var answers = [];
for (var n = 1; n <= N; n++) {
answers[n] = 0;
}
// there is only one way of doing 0 cents?
@aldraco
aldraco / memoize Fibonacci
Created July 27, 2015 22:25
A memozation of Fibonacci, implemented for a CodeEval challenge but preserved here for reference.
function Fibonacci(n) {
// finds the fibonacci number
// base case: 0, 1 for F(0) and F(1)
if (n === 0) {
return 0;
} else if (n === 1) {
return 1;
} else {
return Fibonacci(n-1) + Fibonacci(n-2);
console.log("What the ...");
@aldraco
aldraco / gist:e26ea4cffe7e7fcc1a75
Last active August 29, 2015 14:16
permutations code found on the internet for bonfire challenge
function permAlone(str) {
var permArr = [], usedChars = [];
function permute(input) {
//convert input into a char array (one element for each character)
var i, ch, chars = input.split("");
for (i = 0; i < chars.length; i++) {
//get and remove character at index "i" from char array
ch = chars.splice(i, 1);
//add removed character to the end of used characters