Skip to content

Instantly share code, notes, and snippets.

@jayrobin
jayrobin / Sorting Algorithms
Last active August 29, 2015 13:57
A selection of basic sorting algorithms in Ruby
module SortAlgorithms
def self.benchmark(iterations, method, array)
start_time = Time.now
iterations.times { |i| method.call(array.clone) }
Time.now - start_time
end
def self.bubble_sort(array)
array.each do |elem|
(array.size - 1).times do |i|

#DBC Prep Objectives

For any technical support, please feel free to scope out and post in the Dev Bootcamp Help Facebook group.


1. Personal Preparation

Keep track of the your explanations and results below. You will be asked to submit your responses prior to entering Phase 0.

Learning Objectives
@jayrobin
jayrobin / Numbers to english words
Last active August 29, 2015 13:57
Prompts for a number and outputs the same number in English
# convert a triplet (0-999) into english words representing the value
def triplet_to_words(triplet)
ones = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
teens = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
left_digit = triplet / 100
middle_digit = (triplet % 100) / 10
right_digit = triplet % 10
  • Fetch Changes
  • Peer Pair 1
  • Peer Pair 1 Feedback
  • Peer Pair 2
  • Peer Pair 2 Feedback
  • Meta Feedback 7+ Times
  • Submit Work

Week 8

  • Fetch Changes
  • Peer Pair 1
  • Peer Pair 1 Feedback
  • Peer Pair 2
  • Peer Pair 2 Feedback
  • Meta Feedback 7+ Times
  • Submit Work
@jayrobin
jayrobin / queue.rb
Last active August 29, 2015 14:04
Ruby implementation of queue
class Queue
def initialize(max_size=nil)
@max_size ||= Float::INFINITY
@store = []
end
def enqueue(item)
raise "The queue is full" if self.full?
@store << item
end
@jayrobin
jayrobin / gmaps.js
Created September 11, 2014 16:40
Disabling features on a map
map = new google.maps.Map(document.getElementById("google_map"), mapOptions);
var styles = [
{
featureType: "poi",
stylers: [
{ visibility: "off" }
]
}
];