Skip to content

Instantly share code, notes, and snippets.

View whwebdev's full-sized avatar

Adam Willis whwebdev

View GitHub Profile
@whwebdev
whwebdev / jquery_example.html
Last active August 29, 2015 13:56 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
<!DOCTYPE html>
<html>
<head>
<title>DOM manipulation with jQuery</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery_example.js"></script>
</head>
<body>
@whwebdev
whwebdev / 0.2.1-boggle_class_from_methods.rb
Last active January 2, 2016 07:59 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
attr_reader :dice_grid
def initialize(dice_grid)
@dice_grid = dice_grid
end
def create_word(*coords)
coords.map { |coord| @dice_grid[coord.first][coord.last]}.join("")
end
@whwebdev
whwebdev / gist:8018101
Created December 18, 2013 06:27
Calculating an array of numbers
def median(array)
array.sort!
if array.length % 2 == 0 #if the array contains an even number of elements
(array[(array.length / 2) -1] + array[(array.length / 2)]) / 2.0
else
array[array.length / 2] #if the array contains odd # of elements
end
end