Skip to content

Instantly share code, notes, and snippets.

View ashleygwilliams's full-sized avatar
>o_o<

ashley williams ashleygwilliams

>o_o<
View GitHub Profile
@ashleygwilliams
ashleygwilliams / sinatra_3.md
Last active December 18, 2015 22:18
part 3

#Sinatra: Part 3

Objectives

Continue re-creating the student website as a dynamic web application using Sinatra and the Student Class you created in the Student Class DB lab.

  • Add a route/controller for the students individual profile pages.

  • Add the ERB template for the students individual profile pages.

@ashleygwilliams
ashleygwilliams / gist:5860467
Last active December 18, 2015 23:19
notes to help group build dropdown menu
do this first:
http://www.codeschool.com/courses/try-jquery
include jquery in your layout
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
stackoverflow: how do i change options in dropdown with jquery?
http://stackoverflow.com/questions/1801499/how-to-change-options-of-select-with-jquery
<option> MDN https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option
@ashleygwilliams
ashleygwilliams / citibike_sinatra.md
Last active June 26, 2016 01:29
an app to practice forms in sinatra, using JSON station data from citibike NYC.

#citibike citibike Sinatra forms

Objectives

  1. create a form in HTML
  2. using ERB, populate a select element with options from a JSON file
  3. understand how to use the name and value attributes to populate a params hash of user inputted data
  4. create a route to respond to a post from the form
  5. create instance variables from the params hash in your route so you can use it in a view
  6. use embedded ruby to plot points on a map using javascript
@ashleygwilliams
ashleygwilliams / index.md
Last active December 19, 2015 02:48
exercise for creating resourceful routes in sinatra with datamapper

#Questions

** Questions should be answered with the simplest, most barebone solution possible.

###1. Arrays

array = ["Blake","Ashley","Jeff"]

a. Add a element to an array
@ashleygwilliams
ashleygwilliams / app-pt1.rb
Last active December 19, 2015 08:19
gists for ratpack github.io site
# app.rb
require 'bundler'
Bundler.require
# app.rb
Dir.glob('./lib/*.rb') do |model|
require model
end
# app.rb
module Name #change 'NAME' to your project name
class App < Sinatra::Application
#...all the stuff! (or at least, most of it)
end
end
# config.ru
require File.join(File.dirname(__FILE__), 'app.rb')
run Name::App