Skip to content

Instantly share code, notes, and snippets.

View jwo's full-sized avatar

Jesse Wolgamott jwo

View GitHub Profile
@jwo
jwo / wayCoolCtrl.js
Created March 4, 2014 22:18
wayCoolCtrl showing promises in Angular
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 $scope.map.center;
};
@jwo
jwo / _form.html.erb
Created March 17, 2014 17:33
Possible Additions to Chapter 7.2 of Angularails
<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>
<ul>
<% @widget.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
@jwo
jwo / my_brigade.rb
Created June 10, 2014 18:33
Super Flipping Sweet homework from The Iron Yard
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
jwo / car.rb
Created June 11, 2014 17:25
my day-3 homework (car)
class Car
attr_reader :front_wheels
def initialize
wheel = Wheel.new
wheel2 = Wheel.new
wheel3 = Wheel.new
wheel4 = Wheel.new
@front_wheels = [wheel, wheel2]
@jwo
jwo / relationships.rb
Created August 11, 2014 17:45
TIYA review of relationships
class Order
has_many :line_items
has_many :cupcakes, through: :line_items
def total_price
totals = line_items.map(&:total) # 50, 50, 100
totals.sum
totals.inject(:+)
@jwo
jwo / scholastic.rb
Created August 12, 2014 15:05
scholastic.rb
class User
has_many :orders
attr_accessor :name
attr_accessor :devise
end
class Book
has_many :line_items
has_many :orders, through: :line_items
attr_accessor :title
@jwo
jwo / think-code-evaluate-refactor.rb
Created September 10, 2014 16:51
think-code-evaluate-refactor.rb
class Brain
def think; end
def code ; end
alias evaluate think
alias refactor code
end
brain = Brain.new
<ul>
{{#each color in model}}
<li>{{color}}</li>
{{/each}}
</ul>
@jwo
jwo / contact_search.rb
Created December 3, 2014 21:47
Search by company and first/last name. But: be able to choose if its first/last AND company vs first/last OR company
class ContactSearch
attr_reader :params
def initialize(params)
@params = params
@all_filters = params[:all_filters].to_s == "true"
end
def search
@jwo
jwo / lineAtPoint.c
Created December 9, 2014 18:30
Code in a book. Author must have been like "I'mma gonna drop this right here."
-(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);