Skip to content

Instantly share code, notes, and snippets.

@jli-hashrocket
jli-hashrocket / Recursive sorting
Created September 14, 2013 15:09
Sorting problem in Ch. 12 section Rite of Passage:Sorting
def sort(mylist)
recursive_sort(mylist,[])
end
def recursive_sort(unsorted_array, sorted_array)
if unsorted_array[1] == nil
sorted_array.push unsorted_array[0]
false
elsif unsorted_array[0] == nil
false
@jli-hashrocket
jli-hashrocket / Number Shuffle
Created October 27, 2013 18:56
Number Shuffle problem in Ruby Monk Problem Statement Given a 3 or 4 digit number with distinct digits, return a sorted array of all the unique numbers than can be formed with those digits.
def factorial(number)
if number <= 1
1
else
number * factorial(number - 1)
end
end
def number_shuffle(number)
new_array = []
number = number.to_s
@jli-hashrocket
jli-hashrocket / gist:7536825
Created November 18, 2013 22:52
Cashier 3
#User Story2
#As a seller
#I want to quickly enter purchases without manual entry
#so that I can calculate the order total.
#Acceptance Criteria 1
#Enter items without manual price entry
#Specify the quantity of items
#Return a subtotal
@jli-hashrocket
jli-hashrocket / gist:7548574
Created November 19, 2013 16:55
mailing list with optional challenge completed
=begin
salutations = [
'Mr.',
'Mrs.',
'Mr.',
'Dr.',
'Ms.'
]
=end
salutations = [
@jli-hashrocket
jli-hashrocket / game_data.rb
Last active December 28, 2015 19:59
game data
require 'pry'
games = [
{
home_team: "Patriots",
away_team: "Broncos",
home_score: 7,
away_score: 3
},
{
$(function(){
var MemoryGame = function(){
this.init();
};
MemoryGame.prototype = jQuery.extend(MemoryGame.prototype, {
init: function(){
var deck = [1,5,3,5,7,8];