Skip to content

Instantly share code, notes, and snippets.

Reiterting that no one is perfect, the lesson is trying to stress the importance of understanding the terms used when dealing with bugs.
The three given first are
"Throw - when an interpreter returns an error, it is known to "throw" the error.
Catch - when your code pro-actively accounts for the possibility of an error. An interpreter can throw errors, and you can write code to catch errors in your methods.
Handling - the act of catching an error in your code, and then doing something based on that error."
The lesson advises that when you get an error, read the message carefully to try to glean the solution from the statement. Ruby is supposed
To get this started, i opened the terminal and entered IRB for the interactive ruby shell. I entered the requried methods
Joses-MacBook-Air:first-app JRV$ irb
2.0.0-p451 :001 > def add(a,b)
2.0.0-p451 :002?> a-b
2.0.0-p451 :003?> end
=> nil
2.0.0-p451 :004 > p add(5,4)
1
=> 1
Working on deploying to new relic as it is the first time I have used it, but have heard about it for the last year.
it started with entering from the command line within the app director the following code
$ heroku addons:add newrelic:stark
at first it wouldnt perform the add on: however after I verified by using my credit card it worked out fine.
The following was the output.
Joses-MacBook-Air:first-app JRV$ heroku addons:add newrelic:stark
I decided to try my luick and see how much I remebered from my first depoyment to heroku: luckily I had already installed heroku to the system in 2013, and had an account with a functioning app:
http://shielded-river-4844.herokuapp.com
Deploying to heroku requires we change the gem file: Gems are as follows:
Gems can be used to extend or modify functionality within a Ruby application. Commonly, they're used to split out reusable functionality that others can use in their applications as well. Some gems also provide command line utilities to help automate tasks and speed up your work.
So for the first-app in rails, we have to add postgres functionality
@JoseJRVazquez
JoseJRVazquez / Ruby lessons on syntax
Created April 3, 2014 03:55
Ruby Notes: First Checkpoints
The Difference between p and PUTS = Puts results in the value output as a string, whereas p simply outputs the true value of the object
Variables must start with lower case letter:
my_string_variable = "hello world"
p my_string_variable
will print out
hello world
@JoseJRVazquez
JoseJRVazquez / initial note
Created April 2, 2014 21:21
Bloc.io Notes
The Difference between p and PUTS = Puts results in the value output as a string, whereas p simply outputs the true value of the object
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e