Skip to content

Instantly share code, notes, and snippets.

View spilledmilk's full-sized avatar

Jane Kim spilledmilk

View GitHub Profile
@spilledmilk
spilledmilk / Revised file: analysis.md
Last active May 20, 2016 19:14
[Devschool] javascript coding challenges
  var evenNums = function(ary) {
    return ary.filter(function(num) { return num % 2 === 0 });
  };

vs

  var evenNums = function(ary) {
    var evens = [];
 ary.filter(function(num) { if (num % 2 === 0) { evens.push(num) }
def recursive_fib(n)
n <= 1 ? n : recursive_fib(n - 1) + recursive_fib(n - 2)
end
# recursive_fib
# the method takes argument n (digit desired of fibonacci sequence)
# first checks if n equals either base case (0 and 1), if so, returns n
# if not, sum the two previous digits of n; this will result in two recursive actions, of which
# will continue until each recursion (and their subsequent recursions) reaches the base cases (0 and 1)
# and returns the [total] sum (the nth digit of the sequence)
@spilledmilk
spilledmilk / imgblur-refactor.rb
Created January 3, 2016 22:58
Refactored code for Image Blur challenges (incl. Manhattan Distance)
class Image
attr_accessor :array
def initialize(array)
@array = array
end
def blur(distance = 1)
distance.times do
transform