Skip to content

Instantly share code, notes, and snippets.

View laurenhavertz's full-sized avatar

laurenhavertz

View GitHub Profile

Stock App

flash[:error] = "Symbol can't be blank. Please try again."

  • upon reload flash is empty. Only for instance
@laurenhavertz
laurenhavertz / CookBook.md
Last active December 19, 2015 14:29
RAILS RESOURCES

<%= select_month(Date.today) %> renders drop down of months (can substitue for days and years)

Writing Your Own Helper

module ApplicationHelper

  def pig_latin str
    str + "piglatined"
  end 
@laurenhavertz
laurenhavertz / sinatraproject.md
Last active December 19, 2015 16:48
FRONT END RESOURCES
  1. add source
  2. add gemfile
  3. require files
  4. start with routes
  5. make views files
  6. make public folder with images and stylesheets
  7. change html files in erb files
  8. Create the layout
  9. add the content to the erb files and <% yield %> in the layout
@laurenhavertz
laurenhavertz / nokogiri.md
Last active December 19, 2015 17:08
RUBY GEMS
  1. gem install nokogiri
  • In the subl file:

FooPee.com

        require 'nokogiri'
        require 'open-uri'
        
        url = "https://www.foopee.com/punk/the-list/by-date.1.html"

url_data = Nokogiri::HTML(open(url))

nice default type:

  • Helvetica
  • Georgia

**use 3 fonts max - very different/ strong contrast

  • headlines : meaty/large/bold

  • shades of the same color for palette and then pick accent color with black and white

  • if you're using color photos, use minimal background color

@laurenhavertz
laurenhavertz / Heroku.md
Last active December 19, 2015 23:09
HEROKU

in the Gemfile (if you have datatables)

group :development do
  gem 'sqlite3'
end

group :productions do
  gem 'pg'

end

@laurenhavertz
laurenhavertz / wherethingsgo.md
Last active December 20, 2015 02:19
RAILS RESOURCES

VIEW

  • attaches to controller through yield
  • attaches to helper form action:/search
  • avoid calling controller methods in the view
    • should never tell controller to do something in order for view to render something else

CONTROLLER

  • instance variable
  • connects to view through actions

FOREMAN

-passes keys into a project from the env file

  • when you want to keep things private
    • (example:TWITTER API)
    • has info about your personal account that you don't want exposed on Git or GitHub
  1. in TERMINAL touch .env touch Procfile
@laurenhavertz
laurenhavertz / gist:6081879
Last active December 20, 2015 05:58
JS/CSS RESOURCES
<!DOCTYPE html>

<html>
  <head>
    <title>Animation</title>
    <script type="text/javascript" charset="utf-8">
      // Once the page is loaded
      // Every n milliseconds
      // If the logo is not all the way to the right

// move the logo right 1px

reference :https://github.com/collectiveidea/delayed_job

  1. download gem from the terminal gem list delayed
  2. add gem to gemfile `gem 'delayed_job_active_record'
  3. save file
  4. in the terminal bundle install
  5. in the terminal rails g delayed_job:active_record
    • creates migrations and tables
  6. in the terminal rake db:migrate
  7. in the terminal touch Procfile