Skip to content

Instantly share code, notes, and snippets.

View chyld's full-sized avatar
:electron:
import numpy

Chyld Medford chyld

:electron:
import numpy
View GitHub Profile
@chyld
chyld / gist:3688399
Created September 10, 2012 01:53
iwd 3 final project
Create a new rails app called DinnerTyme
Create a model, view, controller for the following types and also create their associations.
10 points
-- Recipe --
name - the name of the recipe
directions - this are the directions for the recipe
photo
rating - a number between 1 and 5
serves - the number of people it serves
@chyld
chyld / seed.rb
Created September 12, 2012 23:34
seed
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
g1 = Grocery.create(:name => "milk", :quantity => 3)
g2 = Grocery.create(:name => "eggs", :quantity => 12)
@chyld
chyld / asset.txt
Created September 14, 2012 19:02
asset pipeline
# checking the path
rails c
pp Rails.application.config.assets.paths
# in config/application.rb
config.assets.paths << "#{Rails.root}/vendor/assets/bootstrap"
<%= f.button({:class => "btn btn-primary"}) %>
<%= render :partial => 'shared/showsong', :locals => {:song => @song} %>
@chyld
chyld / activerecord.txt
Created October 6, 2012 02:38
activerecord
***database tasks
add_column
add_index
change_column
change_table
create_table
drop_table
remove_column
remove_index
rename_column
@chyld
chyld / gist:3890064
Created October 14, 2012 22:53
monday, oct 15
add twitter bootstrap
change application.html.erb
add new menu
home page
change error messages - use partial with twitter bootstrap
refactor groceries page
@chyld
chyld / gist:3982139
Created October 30, 2012 18:37
IWD 4 final project
Final Project:
05 pts: Create new rails app called DinnerTyme
15 pts: Create the model, view and controllers using this screenshot as a reference:
http://grab.by/h9sC
10 pts: Create a home page (index) using a Home controller
10 pts: Create a navigation system (links) at the top of the site
puts "GIMMIE A NUMBER!"
response = gets.to_i
# asks the user for a number and stores the input into variable response
begin
response.explode
# explodes the program and causes an error
rescue
puts "The square of #{response} is #{response**2}."
//= require jquery
//= require jquery_ujs
//= require_tree .
$(function(){
$('#add_answer').click(add_answer);
});
<%= form_for @question do |f| %>
<div class='field'>
<%= label_tag :question %>
<%= f.text_field :question_text %>
</div>
<div class='field'>
<input type="button" id="add_answer" value="Add Answer" />
</div>
<div id='answers'></div>
<div class='field'>
@chyld
chyld / app.js
Created November 24, 2012 16:24
//= require jquery
//= require jquery_ujs
//= require_tree .
$(function(){
$('#add_answer').click(add_answer);
});