This file contains hidden or 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
// dirListModule.js | |
var fs = require('fs'); //require node filesystem module | |
var path = require('path'); //require node path module (a couple of tools for reading path names) | |
module.exports = function filterDirFiles(pathSupplied, extFilter, callback) { | |
function extension(element) { | |
var extName = path.extname(element); | |
return extName === '.' + extFilter; | |
}; |
This file contains hidden or 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
// asynchDirList.js | |
var fs = require('fs'); //require node filesystem module | |
var path = require('path'); //require node path module (a couple of tools for reading path names) | |
var pathSupplied = process.argv[2]; | |
var extFilter = process.argv[3]; | |
function extension(element) { | |
var extName = path.extname(element); |
This file contains hidden or 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
var dirListModule = require('./dirListModule.js') | |
var dirPath = process.argv[2]; | |
var extFilter = process.argv[3]; | |
dirListModule(dirPath, extFilter, function(err, filteredList) { | |
filteredList.forEach(function(value) { | |
console.log(value); | |
}); | |
}); |
This file contains hidden or 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
<html> | |
<head> | |
<style> | |
.bar { | |
fill: steelblue; | |
} | |
.axis text { | |
font: 10px sans-serif; |
This file contains hidden or 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
{"event":"first visit","properties":{"time":1389806707,"distinct_id":"14398a6d7eb77-0308ffb76-6e1a2776-384000-14398a6d7ec2b4","$browser":"Chrome","$city":"New York","$initial_referrer":"$direct","$initial_referring_domain":"$direct","$os":"Mac OS X","$region":"New York","date":{},"mp_country_code":"US","mp_lib":"web","url":"http://devolate.com/"}} | |
{"event":"first visit","properties":{"time":1389806825,"distinct_id":"14398a8a47aa-094bd1e04-6e1a2776-384000-14398a8a47b421","$browser":"Chrome","$city":"New York","$initial_referrer":"$direct","$initial_referring_domain":"$direct","$os":"Mac OS X","$region":"New York","date":{},"mp_country_code":"US","mp_lib":"web","url":"http://devolate.com/"}} |
This file contains hidden or 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 hidden or 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
module Engine | |
def run | |
puts "GRRRRRRRRR" | |
end | |
end | |
class Vehicle |
This file contains hidden or 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 hidden or 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 hidden or 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 find_duplicate(int_array) | |
current_position = int_array[-1] | |
# Step 1: Get our cursor to the end of the int array list, so that we | |
# are guaranteed to be in a loop when we try to find the loop length | |
(int_array.length - 1).times do | |
current_position = int_array[current_position - 1] | |
end | |
loop_start_position = current_position |