Skip to content

Instantly share code, notes, and snippets.

View notmarkmiranda's full-sized avatar
🏠
Working from home

Mark Miranda notmarkmiranda

🏠
Working from home
  • Smartsheet
  • Longmont, CO
View GitHub Profile
@notmarkmiranda
notmarkmiranda / E001.rb
Created November 28, 2015 02:24
Euler - 001.rb
x = 0
y = 0
while x < 1000 do
if ((x % 3 == 0) || (x % 5 == 0))
y += x
end
x = x + 1
end
@notmarkmiranda
notmarkmiranda / E002.rb
Created November 28, 2015 02:56
Euler - 002.rb
current = 1
previous = 0
sum = 0
new = 0
while new <= 4000000 do
new = current + previous
if (new % 2 == 0)
sum += new
end
@notmarkmiranda
notmarkmiranda / E003.rb
Last active November 28, 2015 05:04
Euler - 003.rb
def isPrime(n)
factors = []
(2..n-1).each do |x|
if (n % x == 0)
return false
end
end
factors << n
puts factors
end
@notmarkmiranda
notmarkmiranda / m1.md
Created March 4, 2016 16:33
Portfolio

Mark Miranda - M1 Portfolio


Individual


Areas of Emphasis

My main goal is to build a solid foundation for the rest of my career at Turing and into the rest of my career. I would like to create good habits and practices to help solidify that foundation. I want to assimilate into the Turing community

Introduction to Sinatra

1. What is the purpose of the server file (routing)?

  • It is the file that directs requests to specific places based on their address passed.

2. How do you pass variables into the views?

  • Instance Variables & :locals hash

3. How can we interpolate ruby into a view (html)?

@notmarkmiranda
notmarkmiranda / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:28 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD. - Create, Read, Update, Delete
  2. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for. a. (get - /folder) - get all items in folder b. (get - /folder/:id) - get single item in folder c. (get - /folder/new) - get view with form to create new view d. (post - /folder) - post new item e. (get - /folder/:id/edit) - get form to edit exisiting item f. (put - /folder/:id) - update existing item g. (delete - /folder/:id) - delete item based on id
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, https://github.com/ondras/wwwsqldesigner/ -->
<!-- Active URL: http://ondras.zarovi.cz/sql/demo/ -->
<sql>
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" quote=""/>
<type label="TINYINT" length="0" sql="TINYINT" quote=""/>
<type label="SMALLINT" length="0" sql="SMALLINT" quote=""/>
<type label="MEDIUMINT" length="0" sql="MEDIUMINT" quote=""/>
## Models, Databases, Relationships in Rails
#### What is the difference between a primary key and a foreign key? Where would we find a primary key? What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key?
* Primary key is a unique identifier in Table. It can exist as a foreign key in AnotherTable or other tables with which it has a relationship. "id" - default name. "table_id" in AnotherTable.
#### Write down one example of:
* Instructor has one office, computer has one charger
#### Write down two examples of a one-to-many relationship.
* Computer has many usb ports, company has many full time employees

Research what each of these Git commands will do. Create a gist that you can share with your team.

git stash

git stash apply

  • reverts back to where you were before you used 'git stash'

git shortlog

Setting Group Expectations

Group Member Names: Deb, Kris, Mark

  1. When are group members available to work together? What hours can each group member work individually? Are there any personal time commitments that need to be discussed?
  • Weekends, after school.
  • We're all pretty open individually.
  • Mark has a Saturday afternooon commitment, Kris and Deb have mentor sessions after school, 2 days per week.