This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In order to win the prize for most cookies sold, my friend Alice and I are going to merge our Girl Scout Cookies orders and enter as one unit. | |
# | |
# Each order is represented by an "order id" (an integer). | |
# | |
# We have our lists of orders sorted numerically already, in arrays. Write a method to merge our arrays of orders into one sorted array. | |
# | |
# For example: | |
# | |
# my_array = [3, 4, 6, 10, 11, 15] | |
# alices_array = [1, 5, 8, 12, 14, 19] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Intro | |
Writing changeable code: three different skills | |
- 1. understand OO design. Code that is easy to change IS well designed. | |
- 2. skilled at refactoring. Quote from Fowler | |
--> also maybe insert quote from Kent Beck: | |
"make the change easy (warning: this may be hard), then make the easy change" | |
- refactoring is how you morph code to accommodate new requirements. Prefactor vs refactor? | |
- 3. High value tests! | |
- Good tests don't need to be changed when you refactor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mixpanel_export.js | |
// node modules | |
http = require('http'); | |
Mixpanel = require('mixpanel'); | |
md5 = require('MD5'); | |
jsoncsv = require('jsoncsv'); | |
fs = require('fs'); | |
stringify = require('csv-stringify'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What does the following code print to the console? | |
var person = { | |
name: "Joe Camel", | |
age: 42, | |
status: "dead" | |
} | |
console.log(typeof person); | |
--> Object {name: "Joe Camel", age: 42, status: "dead"} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What does the following code evaluate to? | |
var first_name = function (name) { | |
return name; | |
} | |
first_name("bob"); | |
--> 'bob' | |
What does the following code evaluate to? | |
function add(x, y) { | |
return x + y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> typeof(3) | |
'number' | |
> typeof(3) === typeof(4.32) | |
true | |
> 5/0 | |
Infinity | |
> 3/"bob" | |
NaN | |
> NaN === NaN | |
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibo_finder | |
if n < 2 | |
n | |
else | |
fibo_finder(n-1) + fibo_finder(n-2) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |config| | |
# Use color in STDOUT | |
config.color_enabled = true | |
# Use color not only in STDOUT but also in pagers and files | |
config.tty = true | |
# Use the specified formatter | |
config.formatter = :documentation # :progress, :html, :textmate | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9.times do |i| | |
puts i | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i = 0; i < 10; i++){ | |
console.log(i); | |
} |