Skip to content

Instantly share code, notes, and snippets.

@waneka
waneka / num_in_words.py
Created July 29, 2014 06:44
python code kata
BELOW_TWENTY = {
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
9: "nine",
@waneka
waneka / git_github.md
Last active August 29, 2015 14:04
dbc phase 1 git workshop

dbc phase 1 git / github workshop

** i've found that often phase 1er's have a pretty jumbled idea of some of the basic git commands and why they're relevant to them as software engineers. i try to approach this lecture from a 'myles' perspective, meaning 'this is how to be a good developer'. teaching them the basic git workflow might be somewhat out of scope of their workflow for phase 1, but often ties together the loose ends of their understanding of git.

Objective

provide students with a more thorough understanding of git and github. main learning objectives are:

  • understanding Git vs Github
  • what happens when I clone
  • typical "realworld" git workflow
  • tools
var a = process.argv[2],
b = process.argv[3]
var container = []
function sample(members, limit) {
for (var i=0;i<members;i++) {
container.push(~~(Math.random() * limit) + 1)
}
return container
}
var input = process.argv[2]
var matcher = { 41: 40, 93: 91, 125: 123 }
var tracker = []
input.split('').forEach(function(symbol) {
var code = symbol.charCodeAt(0)
if (code === 40 || code === 91 || code === 123) {
tracker.push(code)
} else if (code === 41 || code === 93 || code === 125) {
@waneka
waneka / in_words_tyler_and_nick
Created March 11, 2014 05:10
Phase 1 in_words function TO ZILLIONS! (with TDD)
ONES_PLACE = {
1 => "one",
2 => "two",
3 => "three",
4 => "four",
5 => "five",
6 => "six",
7 => "seven",
8 => "eight",
9 => "nine"
@waneka
waneka / Ruby Snippets.rb
Created November 19, 2013 23:15
A selection of Ruby snippets
The following are snippets from the fantasy politics web app that we made. Unfortunately,
it's not currently online for your viewing. :(
This is a snippet from the view for the team page.
<h3><%= @queried_team.name %> <br>Total Score: <%= @queried_team.team_score(1) %></h3>
<p>A team can consist of up to four senators and four congressmen</p>
<div id="team_members">
<h4>Team Members:</h4>
<ul class="sortable">
@waneka
waneka / Javascript Snippets.js
Last active December 28, 2015 19:59
These snippets are some examples of some javascript that I've written.
Here are two snippets of JavaScript that I am proud of from a project called queued.fm which is a web app
that allows for collaborative DJing at a party. Check the app out here: http://qd-fm.herokuapp.com/
This first snippet handles the upvote process when users click on a song in the queue. We used Firebase to handle
all the backend for the site. The Sync functions you see are just checking Firebase to see if that user has
previously voted on that particular song.
upVote: function(e){
var songItem = $(e.target).closest('li')
var songID = songItem.data('songkey')
@waneka
waneka / helpers.md
Last active December 24, 2015 22:49

Solution for Challenge: Research: View and Form Helpers. Started 2013-10-05T19:23:49+00:00

link_to

link_to is a rails helper that helps generate html link tags in views and controllers. link_to "relies on" (whatever that means) url_for - a similar (but different) helper that generates links in views and controllers. From the [ActionView docs] (http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to):

link_to(name = nil, options = nil, html_options = nil, &block)

Creates a link tag of the given name using a URL created by the set of options.

*Solution for Challenge: Research: View and Form Helpers. Started 2013-10-05T19:23:49+00:00*
# link_to
**link_to** is a rails helper that helps generate html link tags in views and controllers. ``link_to`` "relies on" (whatever that means) ``url_for`` - a similar (but different) helper that generates links in views and controllers. From the [ActionView docs] (http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to):
```ruby
link_to(name = nil, options = nil, html_options = nil, &block)
```
*Creates a link tag of the given name using a URL created by the set of options.*
class Disasters
attr_reader :name, :yield_destroyed, :probability
def initialize(name, yield_destroyed, probability)
@probability = probability
@name = name
@yield_destroyed = yield_destroyed
end
end