{{ message }}

Instantly share code, notes, and snippets.

# Kayla Fitzsimmonsfitzk

• United States
Last active Feb 17, 2017
 /* * docs * Webtask - https://webtask.io * Twitter - https://dev.twitter.com/oauth/application-only * note * Here is an easy way to base64 your consumer key and consumer secret * from the command line: * * echo -n "CONSUMER_KEY:CONSUMER_SECRET" | base64 *
Last active Feb 9, 2017
Maximum Sub Array Contiguous, a Greedy Implementation
View max-sum.js
 const trivialCase = [ 5, -6, 7, 12, -3, 0, -11, -6 ]; function sumValues(a, b) { return a + b } function sumSubArraysStartingAtValue(arr, i) { let sums = [] for(let j = i+1; j < arr.length; j++ ) {
Last active Feb 7, 2017
Find all permutations of a string using recursion.
View recursive-permutations.js
 function getPermutations(string, p) { if(string.length <= 1) return new Set(string) let allCharsExceptLast = string.slice(0, -1) let lastChar = string[string.length - 1] let permutationsOfAllCharsExceptLast = getPermutations(allCharsExceptLast); let permutations = new Set() for(let perm of permutationsOfAllCharsExceptLast) {
Created Feb 2, 2017
Data Processing: Given an array of integers with fixed positions (ie, stocks), this script calculates trends based on positive, negative, or plateaued growth. This function excludes information about the relationship between trends, though some relationships can be easily inferred.
View trends.py
Last active Jan 31, 2017
HackerRank: Python3 Agency List class and builder function.
View agency-list.py
 class AgencyList: def __init__(self): self.verticies = list() self.edges = dict() # dict of lists def initEdge(self, v1, v2): if not v1 in self.edges: self.edges[v1] = list() if not v2 in self.edges: self.edges[v2] = list()
Last active Jan 31, 2017
HackerRank: input processing, Agency List class, and logic to solve problem
View agency-list-jtm.js
 // input processing function createMatrix(rows) { // regex to filter only digits let re = /[0-9]/ let matrix = [] for ( let row of rows ) { matrix.push( row.split(' ') .filter( i => re.test(i) === true) .map( i => parseInt(i) ) .sort( (a,b) => a - b ) );
Last active Feb 8, 2017
Generates a JSON object of Donald Trump's tweets and their associated meta-data.
View trump_tweets.py
 import tweepy import json CONSUMER_KEY = # your consumer key CONSUMER_SECRET = # your consumer secret ACCESS_KEY = # your access key ACCESS_SECRET = # your access secret auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
Last active Jan 31, 2017
HackerRank: merge sort function https://repl.it/EVhs/13
View merge-sort.py
 # MergeSort Recursive Solution # Python def Merge(left, right, original): left_len = len(left) right_len = len(right) left_index = 0 right_index = 0 original_index = 0
You can’t perform that action at this time.