Skip to content

Instantly share code, notes, and snippets.

View vpivo's full-sized avatar

Victor Pivo vpivo

View GitHub Profile
@vpivo
vpivo / Seperate Numbers with Commas
Created March 1, 2013 08:44
Seperate Numbers with Commas
def separate_comma(number)
if number < 1000
puts "silly"
end
snumb = number.to_s
array = snumb.split('')
cstr = ''
counter = 0
@vpivo
vpivo / movies.rb
Created March 12, 2013 20:43
To improve
movies = { gone_with_the_wind: 3, the_lion_king: 4, the_matrix: 4 }
puts "What would you like to do?"
puts "--Type 'add' to add a movie."
puts "--Type 'update' to update a movie."
puts "--Type 'display' to display a move."
puts "--Type 'delete' to delete a movie."
choice = gets.chomp.downcase
case choice
@vpivo
vpivo / journal.rb
Created March 14, 2013 22:51
Super Simple Journal Writer
date= Time.now.strftime("%m/%d/%y")
puts "Please enter your journal entry for #{date}"
entry_body = gets.chomp!
filename = "Journal_#{Time.now.strftime("%m/%d/%y")}"
jounral_entry = File.new("#{filename}.txt", "w+")
journal_entry puts entry_body
@vpivo
vpivo / column.rb
Created April 6, 2013 00:07
columns and rows
die_array= [["A", "A", "E", "E", "G", "N"],
["E", "L", "R", "T", "T", "Y"],
["A", "O", "O", "T", "T", "W"],
["A", "B", "B", "J", "O", "O"],
["E", "H", "R", "T", "V", "W"],
["C", "I", "M", "O", "T", "U"],
["D", "I", "S", "T", "T", "Y"],
["E", "I", "O", "S", "S", "T"],
["D", "E", "L", "R", "V", "Y"],
["A", "C", "H", "O", "P", "S"],
@vpivo
vpivo / POODR.txt
Last active December 16, 2015 04:59
Notes from Practical Object Oriented Design in Ruby
*Objects have their own behavior.
*Objects interact with each other via methods.
*Objects should know as little about each other as possible.
*Create objects with room for change.
*You can not fully design software before writing it.
Designing classes with a single responsibilty.
*Classes should have a single responsibilty.
*Nouns make good classes.
*Try to descibe a class in one sentence, without using and.
Format:
$(document).ready(function() {
$(thingToClick).event(function() {
$(thingToAffect).effect();
});
});
$(document).ready(function() {
$('button').click(function() {

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.
@vpivo
vpivo / GitCheatSheet.txt
Last active December 17, 2015 12:29
Git Cheat Sheet
git config --global user.name "Your Name"
Sets the global username.
git config --global user.email [email protected]
Sets the global email.
git config --global alias.co checkout
Creates an alias for checkout, now I just need to type co.
git config --global core.editor "subl -w"
@vpivo
vpivo / herokucheatsheet
Created May 20, 2013 04:39
Heroku Cheat Sheet
heroku create
Creates a new sub domain.
git push heroku master
Deploys
heroku rename NEW NAME
Renames app.