Skip to content

Instantly share code, notes, and snippets.

jwo / wayCoolCtrl.js
Created Mar 4, 2014
wayCoolCtrl showing promises in Angular
View wayCoolCtrl.js
greenvilleJS.controller('wayCoolCtrl', ['$scope', '$q', function ($scope, $q) {
$scope.address = "";
$scope.mapMarkers= [];
$scope.zoom = 8;
$scope.geoCoder = new google.maps.Geocoder();
$scope.mapCenter = function() {
return $;
jwo / _form.html.erb
Created Mar 17, 2014
Possible Additions to Chapter 7.2 of Angularails
View _form.html.erb
<div ng-app="AngulaRails" ng-controller="WidgetController" ng-init="setWidget(<%= @widget.to_json %>);">
<%= form_for @widget, id: "widgetForm", html: { name: "widgetForm", "novalidate" => true, "ar-submit" => true } do |f| %>
<% if @widget.errors.any? %>
<div class="alert alert-danger">
<h4><%= pluralize(@widget.errors.count, "error") %></h4>
<% @widget.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
jwo / my_brigade.rb
Created Jun 10, 2014
Super Flipping Sweet homework from The Iron Yard
View my_brigade.rb
my_brigade = {}
my_brigade[:Chef_de_Cuisine] = "the Head Chef in charge of the kitchen"
my_brigade[:Sous_Chef] = "2nd in Charge to the Chef de Cuisine"
my_brigade[:Saucier] = "who Prepares sauces, soups, and finishes dishes"
my_brigade[:Rotisseur] = "the Grill cook who prepares meat dishes"
my_brigade[:Poissonnier] = "the Cook in charge of fish dishes"
my_brigade[:Entremetier] = "the Cook in charge of Vegetable and Pasta Dishes"
my_brigade[:Garde_Manger] = "the Cook who prepares cold dishes, salads, and charcuterie"
my_brigade[:Tournant] = "the Cook who helps in any station as necessary"
my_brigade[:Patissier] = "the Cook who prepares deserts and sweet dishes"
jwo / car.rb
Created Jun 11, 2014
my day-3 homework (car)
View car.rb
class Car
attr_reader :front_wheels
def initialize
wheel =
wheel2 =
wheel3 =
wheel4 =
@front_wheels = [wheel, wheel2]
jwo / relationships.rb
Created Aug 11, 2014
TIYA review of relationships
View relationships.rb
class Order
has_many :line_items
has_many :cupcakes, through: :line_items
def total_price
totals = # 50, 50, 100
jwo / scholastic.rb
Created Aug 12, 2014
View scholastic.rb
class User
has_many :orders
attr_accessor :name
attr_accessor :devise
class Book
has_many :line_items
has_many :orders, through: :line_items
attr_accessor :title
jwo / think-code-evaluate-refactor.rb
Created Sep 10, 2014
View think-code-evaluate-refactor.rb
class Brain
def think; end
def code ; end
alias evaluate think
alias refactor code
brain =
View index.hbs
{{#each color in model}}
jwo / contact_search.rb
Created Dec 3, 2014
Search by company and first/last name. But: be able to choose if its first/last AND company vs first/last OR company
View contact_search.rb
class ContactSearch
attr_reader :params
def initialize(params)
@params = params
@all_filters = params[:all_filters].to_s == "true"
def search
jwo / lineAtPoint.c
Created Dec 9, 2014
Code in a book. Author must have been like "I'mma gonna drop this right here."
View lineAtPoint.c
-(Line *)lineAtPoint:(CGPoint)p
for (Line *l in self.finishedLines){
CGPoint start = l.begin;
CGPoint end = l.end;
for (float t=0.0; t<=1.0; t+= 0.05){
float x = start.x + t * (end.x - start.x);
float y = start.y + t * (end.y - start.y);