Skip to content

Instantly share code, notes, and snippets.

@jchod77
jchod77 / parse
Created March 30, 2015 19:12
CMM Parser
# Parse and Count problem
require 'pathname'
def scan(path)
file = File.open(path).each_line do |line|
line.split.each do |word|
word = word.gsub(/[.,()?"]/, "")
if @word_hash[word]
@word_hash[word] += 1
else
@jchod77
jchod77 / helloworld
Created March 30, 2015 19:10
CMM Front-end
<!-- Front END Problem -->
<!DOCTYPE html>
<body id='body'>
<div class="newDiv"id="myDiv">Hello, World</div>
</body>
<style type="text/css">
#myDiv {
text-align: center;
background: #33cc33
@jchod77
jchod77 / lecture_notes_2.md
Last active August 29, 2015 14:01
Day 2 phase 3 afternoon lecture
  • Unit testing == testing small things like methods/classes
  • Integration testing == drives you towards TDD
  • go to ruby-gems to find the latest version of a gem you are using
  • when calling '~>x.x.y on gem it accepts any version with x.x. y can be anything
  • expect ()- when you have an output your expecting from the obj being tested
  • expect {}- when you have a side effect of running your code
  • need selenium or phantom js to test ajax calls in your app
@jchod77
jchod77 / holy_shit_theres_a_helper_for_that.md
Last active August 29, 2015 14:01
Helpful Rails methods

distance_of_time_in_words

Example:

<% start_time =  "2012-03-02 14:46:21 +0100" %>
<% end_time   =  "2012-04-02 14:46:21 +0200" %>
<%= distance_of_time_in_words(start_time, end_time)  %>

 "about 1 month"
@jchod77
jchod77 / day_1.md
Created May 12, 2014 21:32
Day_1 questions
  • Is creating a new resource :something in router best practice if you're only using 2 of the RESTful routes (ie: user authentication?
  • where should partials be saved if they're used across different view folders?
    • A- where ever you want, though you have to specify the path (ie:'shared/form')
@jchod77
jchod77 / rails_run_through.md
Last active August 29, 2015 14:01
First lecture- Phase 3

Day 1 Phase 3

  • Neo- premier Rails shop in Columbus
  • Understand what you're using. Including gems!
  • Standard Unix env has 2 outs
    • standard out
    • standard error
  • less .gitnore
  • outside libraries (ie: bootstrap, angular) go in vendor
  • database.yaml file holds db info
@jchod77
jchod77 / rails_intro_notes.md
Last active August 29, 2015 14:01
intro-to-rails-talk-notes
  • Create a new rails app in terminal by entering rails new APPNAME
  • rake db:setup runs the following commands:
    • rake db:create
    • rake db:schema load *rake db:seed
    • good for getting a db env up and running quickly
  • Routes == main control center for your app
    • place where specify what things your app resonds to and when to find the code to run
  • Instead of writing routes in your controller, write methods
  • All of your controllers should inherit from ApplicationController
@jchod77
jchod77 / TDD_notes.md
Last active October 21, 2021 23:28
TDD prep video notes

Test-Driven Development

Write better code in less time by Evan Dorn Link to video

  • Caveat #1- Intelligence is a liability when trying to write good software.
    • Smart people can make progress, without proper PROCESS
    • Not a good thing when trying to deliver high quality software and working in large teams
      • Analogous to a builder saying "We know how skyscrapers work, just give us the bricks and we'll get started."
  • Successful Professionals (across all fields)
@jchod77
jchod77 / rails_resources.md
Last active August 29, 2015 14:01
Rails resources
@jchod77
jchod77 / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:55 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
class BoggleBoard
def initialize(boggle_board)
@boggle_board = boggle_board
end
def create_word(*coords)
coords.map { |coord| @boggle_board[coord.first][coord.last]}.join("")
end