Skip to content

Instantly share code, notes, and snippets.

@pdwittig
pdwittig / inc_mean.rb
Created July 17, 2014 06:43
incremental mean
def inc_mean arr
current_sum = 0
arr.map!.with_index do |val, index|
current_sum += val
current_sum.to_f / (index + 1)
end
return arr
end
arr = [10, 10, 15, 15, 20]

##Floats Floats allow elements to flow naturally within the a page in relation to each other.

######Example In the example below, the three box elements will float on a single row withing the parent div

.box {
  float: left;
  width: 30%;
}
@pdwittig
pdwittig / 1_jquery_example.md
Last active August 29, 2015 13:57 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0

######REFLECTION This challenge was pretty cool. Jquery seems pretty sweet, and it's nice that it conatins a bunch of prepaackaged stuff that works across browsers. I do have a question though - when is it appropriate to use jquery over plain javascript?

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/normalize.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale = 1.0, user-scalable = no">
<title>MapWich</title>
<script type="text/javascript"
@pdwittig
pdwittig / test.md
Created February 19, 2014 20:00
test

THIS IS A TEST GIST

@pdwittig
pdwittig / 0.2.1-boggle_class_from_methods.rb
Created February 2, 2014 17:30 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
#your code here
def initialize(dice_grid)
@dice_grid = dice_grid
end
def create_word(*coords)
coords.map { |coord| @dice_grid[coord.first][coord.last] }.join
end