Skip to content

Instantly share code, notes, and snippets.

View ciprianna's full-sized avatar

Ciprianna Engel ciprianna

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ciprianna on github.
  • I am ciprianna (https://keybase.io/ciprianna) on keybase.
  • I have a public key ASDsxpwL81PFvFAey6pQ66CDOEFAE_jKvw31LSoqRgnGDAo

To claim this, I am signing this object:

@ciprianna
ciprianna / add_shoe.erb
Created June 22, 2015 04:07
Inventory Manager with Sinatra
<head><center><h1>Add a New Shoe</h1></center></head>
<body>
<center>
<form action="/save_new_shoe">
<p>Product name
<input type="text" name="name" placeholder="Product Name"></p>
<p>Cost
<input type="number" name="cost" placeholder="Cost"></p>
<p>Color
<input type="text" name="color" placeholder="Color"></p>
@ciprianna
ciprianna / app.rb
Last active August 29, 2015 14:23
Shoe Inventory - ORM
# Driver
require "sqlite3"
require_relative "menu_module.rb"
require_relative "validity_module.rb"
require_relative "database_class_methods.rb"
require_relative "database_instance_methods.rb"
require_relative "shoes.rb"
require_relative "location.rb"
require_relative "category.rb"
@ciprianna
ciprianna / app.rb
Last active August 29, 2015 14:23
Shoe Database
# Driver
require "sqlite3"
require_relative "shoes.rb"
require_relative "location.rb"
require_relative "category.rb"
# Creates the database connection
DATABASE = SQLite3::Database.new("shoe_inventory.db")
@ciprianna
ciprianna / checksplitter.rb
Created June 11, 2015 19:45
CheckSplitter with SQL
# Check Splitter Info
# Check Splitter
# Creates new class called CheckSplitter
class CheckSplitter
# Shows which attributes are accessible
attr_accessor :total_cost, :tip_percentage, :people, :args
@ciprianna
ciprianna / resource_class.rb
Created June 11, 2015 17:14
Resource Program - SQL
# Resource Class
require "sqlite3"
# Creates the database connection
DATABASE = SQLite3::Database.new("pets.db")
# Creates the table
# DATABASE.execute("CREATE TABLE cats (id INTEGER PRIMARY KEY, name TEXT, age INTEGER);")
@ciprianna
ciprianna / dinner_club.rb
Created June 10, 2015 20:58
Dinner Club Test
# Dinner Club
require './club_event.rb'
class DinnerClub
attr_accessor :running_balance, :club_history
# Creates an empty hash to store the dinner club members and their balance.
# Makes the default value of the hash 0, so that new members can be added.
@ciprianna
ciprianna / gems_vs_apis.markdown
Last active August 29, 2015 14:22
Gems and APIs

Gems vs. APIs

Ruby Gems and APIs are both useful for expanding capabilities of a given program.

A Ruby Gem is a piece of code or files that a user has packaged for distribution and use for all other Ruby users. It serves a specific purpose (or related group of purposes) and is written by Ruby users. It can be continually updated and collaborated on. Gems are available on a public hub (Ruby Gems) for all Ruby users.

APIs are raw code output. They're the pure data without any wrapping/formatting of any kind. Programs build user interfaces on the APIs to make them user-friendly. This can be done using a gem, if someone has created a gem for this purpose. Gems don't require authentication or access, while APIs do, because APIs are often producing large amounts of data that's being used to run/build a program.

@ciprianna
ciprianna / paragraph_truncator.rb
Created June 10, 2015 17:22
Mini Projects with Active Support
require "active_support"
require "active_support/core_ext/String/filters.rb"
puts "What paragraph would you like to truncate?"
paragraph = gets.chomp
puts "How many characters would you like to have?"
character_length = gets.to_i
puts paragraph.truncate(character_length)
@ciprianna
ciprianna / app.rb
Last active August 29, 2015 14:22
Rock, Paper, Scissors - Level 3 - Restructured
# Rock Paper Scissors
require './game.rb'
# This section gets inputs from the user and stores them as player1 and player2.
puts "Let's play Rock-Paper-Scissors."
puts "\n"
puts "Who's player 1?"
name_one = gets.chomp.capitalize
puts "And who is #{name_one} playing against? Or type 'computer' if you'd like to play against the machine."