From c9d6b320126685687c185690ce3b1f6fab38bb85 Mon Sep 17 00:00:00 2001 From: YOUR NAME Date: Mon, 14 Aug 2017 11:34:33 +1000 Subject: [PATCH] Weeks 1 to 2 exercises --- .DS_Store | Bin 0 -> 10244 bytes Example/calculator.rb | 59 +++++++++++++ Example/cloop | 7 ++ Example/cloop.rb | 3 + Example/example.rb | 9 ++ Example/for in | 5 ++ Example/forin | 5 ++ Example/gender & temp.rb | 16 ++++ Example/gender.rb | 18 ++++ Example/temp.rb | 8 ++ My website/.DS_Store | Bin 0 -> 8196 bytes My website/about.html | 0 My website/css/.DS_Store | Bin 0 -> 6148 bytes My website/css/style.css | 0 My website/images/.DS_Store | Bin 0 -> 6148 bytes My website/images/img.jpg | 0 My website/index.html | 0 My website/js/script.js | 0 README.md | 7 ++ array/.DS_Store | Bin 0 -> 6148 bytes array/Atm.rb | 64 ++++++++++++++ array/Untitled.rb | 16 ++++ array/alphabet/al.rb | 9 ++ array/alphabet/dog_classes_objects | 1 + array/alphabet/recipe_ingredients.rb | 1 + array/case&counter example.rb | 21 +++++ array/new shopping.rb | 21 +++++ array/trent.rb | 33 +++++++ array/you guessed it.rb | 17 ++++ atm_classes.rb | 33 +++++++ cars.rb | 33 +++++++ celsiusclass.rb | 50 +++++++++++ classes_objects.rb | 21 +++++ day.rb | 28 ++++++ dog_classes.rb | 11 +++ gems.locked | 10 +++ gems.rb | 4 + penis_program/1.8.0 | 0 penis_program/3classes_app | 1 + penis_program/3classes_app.rb | 40 +++++++++ penis_program/recipe_generetor.rb | 39 +++++++++ penis_program/review.rb | 0 penis_program/review2.rb | 125 +++++++++++++++++++++++++++ penis_program/the_penis.rb | 17 ++++ restaurant_class.rb | 74 ++++++++++++++++ shopping_list | 1 + 46 files changed, 807 insertions(+) create mode 100644 .DS_Store create mode 100644 Example/calculator.rb create mode 100644 Example/cloop create mode 100644 Example/cloop.rb create mode 100644 Example/example.rb create mode 100644 Example/for in create mode 100644 Example/forin create mode 100644 Example/gender & temp.rb create mode 100644 Example/gender.rb create mode 100644 Example/temp.rb create mode 100644 My website/.DS_Store create mode 100644 My website/about.html create mode 100644 My website/css/.DS_Store create mode 100644 My website/css/style.css create mode 100644 My website/images/.DS_Store create mode 100644 My website/images/img.jpg create mode 100644 My website/index.html create mode 100644 My website/js/script.js create mode 100644 README.md create mode 100644 array/.DS_Store create mode 100644 array/Atm.rb create mode 100644 array/Untitled.rb create mode 100644 array/alphabet/al.rb create mode 100644 array/alphabet/dog_classes_objects create mode 100644 array/alphabet/recipe_ingredients.rb create mode 100644 array/case&counter example.rb create mode 100644 array/new shopping.rb create mode 100644 array/trent.rb create mode 100644 array/you guessed it.rb create mode 100644 atm_classes.rb create mode 100644 cars.rb create mode 100644 celsiusclass.rb create mode 100644 classes_objects.rb create mode 100644 day.rb create mode 100644 dog_classes.rb create mode 100644 gems.locked create mode 100644 gems.rb create mode 100644 penis_program/1.8.0 create mode 100644 penis_program/3classes_app create mode 100644 penis_program/3classes_app.rb create mode 100644 penis_program/recipe_generetor.rb create mode 100644 penis_program/review.rb create mode 100644 penis_program/review2.rb create mode 100644 penis_program/the_penis.rb create mode 100644 restaurant_class.rb create mode 160000 shopping_list diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2eda9dc5fc2e963147dbed1c10c34066a1301a30 GIT binary patch literal 10244 zcmeHMPjB2r6n~SZ&2G~q&cCJ=99$x#N{vv`gam}DZnudbR45@El|*UTdTnQ8>h-K_ zZ_+db<-&ynclrS;apuAo;J}F!LgK;~;DChS3cne96R*ALRzyNcHM5#|&*S%I=KbEh z8P6;cv0}rTBGQQ{hb*Xe2}PSE-iw?`U2)AdPzHUX-9?w16_-~svZ_KMpb$_9C^S9z;|w9Vp}x0JIy`GJ(fAKcrxnS$slavUlj|Qk+;JqN-E~CABD=?y*~e@p((YfCiaxw~fpd%uttuz};Ne@8UMjrt=)IfREU%S525jT{O7vn1vrwV_@?>&fio z%?W*aX6D4}Ne{J{=~kyoCa={c*in&^sPXxEs}Y(+KR^HLD=CtZusTT8w>tHb3Wr{} z+=k=CgmN(fOnQuGtJQ^>?Vu;2l?j_nAY7!6FbQ>pxQ!_+!XeB|l0Q?Eq^-^=n=0|v zGk4;t($?6NqxukAHhBO~tOa$fLLyql-d#&Nt4(CTK=X70dh)&e1tzCp&C?3v^bXBq zjxHbuYU#P(Wu#{2FhCazatP=f(g7a$tl3Wb0|;H)BW zE*iKl?*A8#|NsB2ny1FC5Ksub1OlvkzBFHiVDl;^tt0N*b>v6LA_=*Jh)NX{@;V+= xUdQ7>T*u4XAJk2PmkE49FrWt!1&8#%{~6HvK2e?j@!71-|NhHgJ)g1j|G&G{Bg+5) literal 0 HcmV?d00001 diff --git a/Example/calculator.rb b/Example/calculator.rb new file mode 100644 index 0000000..cc044ba --- /dev/null +++ b/Example/calculator.rb @@ -0,0 +1,59 @@ +# This method ask the user what type of calculation they would like to perform +# It returns the operation or an error for erroneous entry +def request_calculation_type + puts "Type 1 to add, 2 to subtract, 3 to multiply, or 4 to divide two numbers: " + operation_selection = gets.to_i + + if operation_selection == 1 + "add" + elsif operation_selection == 2 + "subtract" + elsif operation_selection == 3 + "multiply" + elsif operation_selection == 4 + "divide" + else + "error" + end + +end + +# This method performs the requested calculation +# It returns the result of the calculation +def calculate_answer(operator, a, b) + if operator == "add" + a + b + elsif operator == "subtract" + a - b + elsif operator == "multiply" + a * b + elsif operator == "divide" + a / b + end +end + +run_calculator = 1 + +while run_calculator == 1 + + current_calculation = request_calculation_type() + + if current_calculation == "error" + + puts "I do not understand this type of calculation... Can we try again?" + + else + puts "What is the first number you would you like to #{current_calculation}: " + first_number = gets.to_i + puts "What is the second number you would like to #{current_calculation}: " + second_number = gets.to_i + + answer = calculate_answer(current_calculation, first_number, second_number) + + puts "The answer is #{answer}" + puts "Type 1 to run another calcution or 2 to end: " + run_calculator = gets.to_i + + end + +end diff --git a/Example/cloop b/Example/cloop new file mode 100644 index 0000000..6017b9d --- /dev/null +++ b/Example/cloop @@ -0,0 +1,7 @@ +x = [1, 2, 3, 4, 5] + +for i in x do + puts i +end + +puts "Done!" diff --git a/Example/cloop.rb b/Example/cloop.rb new file mode 100644 index 0000000..89b42c0 --- /dev/null +++ b/Example/cloop.rb @@ -0,0 +1,3 @@ +loop do +puts "suck my dick" +end diff --git a/Example/example.rb b/Example/example.rb new file mode 100644 index 0000000..f9fe7b2 --- /dev/null +++ b/Example/example.rb @@ -0,0 +1,9 @@ + +def age(ntt) + puts "My age is #{ntt}" + puts "My age is #{ntt}" + puts "My age is #{ntt}" +end + + +age(ntt) diff --git a/Example/for in b/Example/for in new file mode 100644 index 0000000..1ac3fa1 --- /dev/null +++ b/Example/for in @@ -0,0 +1,5 @@ +arr = [1, 2, 3] + +for a in arr + puts "element #{a}" +end diff --git a/Example/forin b/Example/forin new file mode 100644 index 0000000..1ac3fa1 --- /dev/null +++ b/Example/forin @@ -0,0 +1,5 @@ +arr = [1, 2, 3] + +for a in arr + puts "element #{a}" +end diff --git a/Example/gender & temp.rb b/Example/gender & temp.rb new file mode 100644 index 0000000..4c5a9fd --- /dev/null +++ b/Example/gender & temp.rb @@ -0,0 +1,16 @@ +puts "what is your gender?" +random = gets.chomp.to_i + +if female == "female" + puts "what is temp?" + +if "female" above 20 = "wear dress" +if random <= 20 + puts "wear shorts!" +else random > 20 + puts "wear pants!" +end + + +male = "wear shorts!" "wear pants!" +def gender(male, female) diff --git a/Example/gender.rb b/Example/gender.rb new file mode 100644 index 0000000..358eb17 --- /dev/null +++ b/Example/gender.rb @@ -0,0 +1,18 @@ +puts "what is your gender?" +random = gets.chomp.to_i + + if female > 20 = "wear dress!" + else random < 20 + puts "wear pants!" + + puts "what is temp?" #and above 20 + +#if "female" above 20 = "wear dress" +#if random <= 20 +# puts "wear shorts!" +#else random > 20 + #puts "wear pants!" +end + + +#def gender(male, female) diff --git a/Example/temp.rb b/Example/temp.rb new file mode 100644 index 0000000..813f970 --- /dev/null +++ b/Example/temp.rb @@ -0,0 +1,8 @@ +puts "how hot is it?" +random = gets.chomp.to_i + +if random <= 20 + puts "wear shorts!" +else random > 20 + puts "wear pants!" +end diff --git a/My website/.DS_Store b/My website/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f8fe0d6a71f3477d01588069b682126072aaa92e GIT binary patch literal 8196 zcmeHM&2JM&6n~SXV246BkdUBqSP@l1B0>pYp;8gX1X{x(E{-5kpk_ZN&cb@f+Fi$l z5adg*y_b6{aqfk4r5^YL5K>i%OHUPt9;#l;n-4p?YllNQG{B5B^Lw86F`nPc&iHKr zfE1hVEWjiHM7pEi8w_9f))XqE;rVLLp*x^fQGykb*=#Y6dg|y$tZ$eHbjT zfk87_zn6UG*gmsSkB=1j8}ZA3MH4{=!GQ>(v=ux>-KAbDyA?H5tmk&a_o8@a<|P>z z9QtI>-dsMP%kR(KsjRV9CAQ*bRJ6hs@yTi_<{H|=-H$B>_8e^AP5L;eA!-V=)DKsq=GN)8^*f+|0Cj=JdI(tz2&6^Vtif zyY-ESn~%00{~)#rM4dMCnzZrJZD{PkNn)(-YdiCZg6am?!6l1IahltaoRiM1;Y%khHR)WyFf ziBpAgM>sA81E!>aKS~X<7_flm^HYWEYBC2W;1XPe3ch1%!T0b4eu8K4EBpqp;U6+Y z4wGZ#1UW-4kc;GNQXTG`AZN?73 ziywdaQ|P-IcLz;lZKr7Kl`!yGP{TOPgKhGLw&ANo9vU6 zls=W3-$iON`b2{I==-E8<)2B`FeWPi7gP0M`(H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T05Ukb%4=&lzaK1qB4~F9mjQs&Qg+n23Xu)Phy)^Cs3zyM%Lcf`97bMt-onVnU{h;*Luj92V#_lJk=ewKYY;M@y5;RQQf zediyx+!;P6cKQfKrGONW0#ZN4(o{; zrGONeDsZ05!R!AG{fGX4O43RSNP&N)fGsw6n>C+QwRQG5ueFVSPxqV;x*O*~;SlAR j80DA?FUOaWlzGkP-0y{BV$c~6I#E9Zu8T|x{Ivo{bBH4U literal 0 HcmV?d00001 diff --git a/My website/images/img.jpg b/My website/images/img.jpg new file mode 100644 index 0000000..e69de29 diff --git a/My website/index.html b/My website/index.html new file mode 100644 index 0000000..e69de29 diff --git a/My website/js/script.js b/My website/js/script.js new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..eae67da --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# exercises- +# exercises- +# exercises- +# exercises1 +# exercises1 +# exercises1 +# exercises1 diff --git a/array/.DS_Store b/array/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..274412e58fca41a684c519263d85f59b8d820229 GIT binary patch literal 6148 zcmeHK-EPw`6h7X{mNKCg38}mE4Ty^hbqqETLMmlk><+2?TmagVC0Zk;an+;?qZH+a zcL3giN8t&05FP-&W1FgLvr7;{K9c>N*yr=HzchADM4~$mw}~1=( zE4HN$6nYGw0*WXbK|{;1wkBt48~ZZ1b;R6YPiza5KC% z1?G@qw4GG3#m5Dkg_VOWYW?^qALTAVLQiqf17<9E$z$tKE zfmQR^;Pd~<#rOa7B=_VLa0>ia3W(Z%Z@-Hr*|T+NaeUTFlp_>2jw=mn3MzXXYln~G dEfj6&lk5OH7E6O@fw?~dS_W4+1^%i6zW`R;y5Rr- literal 0 HcmV?d00001 diff --git a/array/Atm.rb b/array/Atm.rb new file mode 100644 index 0000000..908bd88 --- /dev/null +++ b/array/Atm.rb @@ -0,0 +1,64 @@ +=begin +-CREATE MINIMUM VIABLE PRODUCT +create a terminal app that behaves like a real life ATM +-greeting --this one +-pin +-accounts +-language +-withdrawal --this one +-check balance --this one +-deposit --this one +------Make them methods, multiple times so loops, gets.chomp, arrays, +=end +prompt_for_more_banking = puts "Would you like to do anything else?" +#present user with "options- deposit, check balance, withdrawal" +balance = 100 +greeting = #start page and this gets looped if doesn't enter somehting valid +puts "We are ghouls, we will take your soul out then charge you a fees, it's your choice how we devour you!" +#loop variable + +def options_loop + puts """ + If deposit press 1 + If check balance press 2 + If withdrawal press 3 + """ +end +options_loop + +user_input = gets.chomp.to_i +if user_input == 1 + puts "How much would you like to deposit?" # + deposit_amount = gets.chomp.to_i + balance = balance + deposit_amount #0 is 0 balance plus the amount the user deposits + puts "You've deposited $#{deposit_amount}" #tells user how much they've deposited + puts "Thank you for your monies! #{options_loop}." + puts "You're new balance is #{balance}" +elsif user_input == 2 + puts "checking balance... " + puts "You have $#{balance}" #tells user their balance + prompt_for_more_banking + options_loop + +elsif user_input == 3 + if balance <= 0 + puts "You have $#{balance} left, we took it all! you poor shit" + prompt_for_more_banking + options_loop + #{options_loop}" + else + puts "How much would you like to withdrawl? You have $#{balance} dollars" + withdrawal = gets.chomp.to_i + puts "You've withdrawn $#{withdrawal}" + puts "You have $#{balance - withdrawal} left..for us to steal" + puts "Make sure you give us more than you take or we'll chase you!" + prompt_for_more_banking + options_loop + end +else + puts "That's not a valid number!" + options_loop +end + +#create a loop called options that returns deposit, check balance, withdrawal +# exit = puts "see ya biaatch!" diff --git a/array/Untitled.rb b/array/Untitled.rb new file mode 100644 index 0000000..afe0b24 --- /dev/null +++ b/array/Untitled.rb @@ -0,0 +1,16 @@ +shoppingList = [("store_Items"), ("store_Items2")] + puts "What do you want to add to your shopping list?" + store_Items = gets.chomp.to_s + + +puts ("You've added #{store_items} in your cart") +puts "Do you wish to add anything else?" +store_Items2 = gets.to_s +puts ("You've added #{store_Items2} in your cart") +#save store_Items2, store_Items in shoppingList +puts "Would you like to view your items?" + store_Items.include? "yes" + + puts "Thanks for using us!" + + puts "#{shoppingList}" diff --git a/array/alphabet/al.rb b/array/alphabet/al.rb new file mode 100644 index 0000000..27edc06 --- /dev/null +++ b/array/alphabet/al.rb @@ -0,0 +1,9 @@ +alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n","o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] +firstLetter = alphabet[0] + +alphabet.push ("i know the best words!") +# '<<' = '.push' +alphabet.each do |letter| +puts "This letter is #{letter}" + +end diff --git a/array/alphabet/dog_classes_objects b/array/alphabet/dog_classes_objects new file mode 100644 index 0000000..c5936ae --- /dev/null +++ b/array/alphabet/dog_classes_objects @@ -0,0 +1 @@ +class.dog diff --git a/array/alphabet/recipe_ingredients.rb b/array/alphabet/recipe_ingredients.rb new file mode 100644 index 0000000..d41c345 --- /dev/null +++ b/array/alphabet/recipe_ingredients.rb @@ -0,0 +1 @@ +recipe_1_ingredients = [] diff --git a/array/case&counter example.rb b/array/case&counter example.rb new file mode 100644 index 0000000..e4c8e46 --- /dev/null +++ b/array/case&counter example.rb @@ -0,0 +1,21 @@ +something = "poo" + + +=begin case something + when "pear" + puts "something is a pear" + when "apple" + puts "something is an apple" + when "orange" + puts "something is an orange" + else + puts "That ain't fruit yo mama gave you!" +end +=end + +# COUNTER +counter = 0 +while counter <= 100..1000 do + puts counter + counter += 23 + end diff --git a/array/new shopping.rb b/array/new shopping.rb new file mode 100644 index 0000000..be1f0ea --- /dev/null +++ b/array/new shopping.rb @@ -0,0 +1,21 @@ +shoppingList =[ + "hummus", + "Avocado", + "ben n jerrys", + "marajuana", + "Guacamole", + l = + [ + "candy", + "lollipop", + "jelly"] + ] +shoppingList = gets.chomp.to_i.to_s +chosenItem = shoppingList[4] +chosen_Stripper = strippers[2] + + +puts "Want ot add an item to your Shopping list?" +puts "#{shoppingList}" +puts "The best thing to have in your tummy is #{chosenItem}" +puts "Take a wild ride with #{chosen_Stripper} in it" diff --git a/array/trent.rb b/array/trent.rb new file mode 100644 index 0000000..e3d33a8 --- /dev/null +++ b/array/trent.rb @@ -0,0 +1,33 @@ +# ask a question +# based of the answer of that question we want too do either: +# withdrawal +# deposit + +answer = 0 +until answer == 3 + system("clear") + puts "hey, do you want to (1) withdraw, or (2) deposit or (3) exit" + answer = gets.chomp.to_i + balance = 100 + + if answer == 1 + system("clear") + puts "how much would you like to withdraw?" + balance = balance - gets.chomp.to_i + puts "your new balance is #{balance}" + sleep(3) + system("clear") + elsif answer == 2 + system("clear") + puts "how much would you like to deposit?" + balance = balance + gets.chomp.to_i + puts "your new balance is #{balance}" + sleep(3) + system("clear") + else + system("clear") + puts "fuck off" + sleep(3) + system("clear") + end +end diff --git a/array/you guessed it.rb b/array/you guessed it.rb new file mode 100644 index 0000000..abd664c --- /dev/null +++ b/array/you guessed it.rb @@ -0,0 +1,17 @@ +shoppingList =[ + "chips", + "water", + "hookers", + "marajuana", + "Guacamole", + alcohol = + [ + "rum", + "whiskey", + "whatever"] + ] +chosenDip = shoppingList[4] +list_Item = shoppingList.length + alcohol.length - 1 + +puts "The best dip in the world is #{chosenDip}" +puts "Your shopping list has #{list_Item} in it" diff --git a/atm_classes.rb b/atm_classes.rb new file mode 100644 index 0000000..8e097d1 --- /dev/null +++ b/atm_classes.rb @@ -0,0 +1,33 @@ +#create accounts +#class Account + #def initialize() + #Create an Atm +class Atm + #how do we descibe the atm + def initialize(location, brand, current_cash, pin) + @location = location + @brand = brand + @current_cash = current_cash + @balance = 100 + @pin = [] + end + + + # what can an atm do? + def dispense(amount) + @balance = @balance - amount + puts "I gave you #{amount} from #{@location} atm, the new balance is #{@balance}" + end + +end + + +broadway_atm = Atm.new("broadway", "commonscum", 100, 1111) +ultimo_atm = Atm.new("ultimo", "peasants", 1000, 1111) +yomama_bank = Atm.new("sydney", "yomama", 100000, 1111) +#Asks for pin + + +broadway_atm.dispense(70) +ultimo_atm.dispense(19000) +yomama_bank.dispense(23330) diff --git a/cars.rb b/cars.rb new file mode 100644 index 0000000..bbadf87 --- /dev/null +++ b/cars.rb @@ -0,0 +1,33 @@ +class Car + #How do we describe the car + def initialize(type, colour, brand, year) + @type = type + @colour = colour + @brand = brand + @year = year + @petrol = 100 + end + #what can it do + + # getter + def colour + @colour + end + + # setter + def colour=(colour) + @colour = colour + end + + def go(time, speed) + puts "move at #{time} + #{speed}" + end +end + +honda = Car.new("4 wheeler", "red", "honda", 2000) +honda.go("1pm", "100Km/hr") + +# puts the color of the car +puts honda.colour +honda.colour = "blue" +puts honda.colour diff --git a/celsiusclass.rb b/celsiusclass.rb new file mode 100644 index 0000000..d734019 --- /dev/null +++ b/celsiusclass.rb @@ -0,0 +1,50 @@ +=begin +Create a Celsius class, that takes the temperature as a parameter. + +Remember to use the `initialize` method +Define a method that returns the temperature in Fahrenheit. For the conversion we can use the formula +`temperature*1.8 + 32`. Round up the result so it doesn’t contain any decimal values. + +Use the round method + +Create a script that prompts you to fill in the temperature for each day of the week (Monday - Sunday) + and for the inputs 16, 17 18, 18, 21, 16, 19 prints out the following output: +=end +=begin +Class weekdays_from_C_to_F + def initialize(mon, tue, wed, thu, fri, sat, sun) + @mon = mon + @tue = tue + @wed = wed + @thu = thu + @fri = fri + @sat = sat + @sun = sun +=end + + + +x = 0 +weekday = 1..7 +#weekday is equal to mon-sun and needs to run through a loop + "mon" = 1 + "tue" = 2 + "wed" = 3 + "thu" = 4 + "sat" = 5 + "sun" = 6 + + + +#make a weekday variable that then loops a question that gets the answer from + +#the user and converts it to Fahrenheit + +until x == 7, weekday ==7 + + puts "what is temperature in Celsius on #{weekday}?" + temp_in_C = gets.chomp.to_i + puts "the temperature on #{weekday} is #{temp_in_C*1.8 + 32} in degrees F." + x = x + 1 + weekday = weekday + 1 +end diff --git a/classes_objects.rb b/classes_objects.rb new file mode 100644 index 0000000..bfb67d6 --- /dev/null +++ b/classes_objects.rb @@ -0,0 +1,21 @@ +#Create a person app + +class.Personfactory +#How do we describe it +def initialize(name, personality, age, hair_colour) + @name = name + @personality = personality + @hair_colour = hair_colour + @age = age + + +#What can we do +end + +def talk(sentence) + puts sentence + end +end + +omar = Personfactory.new("Omar", "Pretty cool", "Brown", 19) +omar.name("yoo") diff --git a/day.rb b/day.rb new file mode 100644 index 0000000..448d8fd --- /dev/null +++ b/day.rb @@ -0,0 +1,28 @@ + + + +class Day + #hoe do we describe it + def initialize(name, temperature) + @name = name + @temperature = temperature + end +end + + +class Temperature + def initialize(celsius) + @celsius = celsius + end + + attr_accessor :temperature + + def to_f + @celsius * 1.8 + 32 + end +end + +box = [] +7.times do (number) + puts "hey, what was the temperature on day #{number}" + x = Day.new(number)emperature. new, diff --git a/dog_classes.rb b/dog_classes.rb new file mode 100644 index 0000000..0c0a0cf --- /dev/null +++ b/dog_classes.rb @@ -0,0 +1,11 @@ +class dog + +def initialize(colour, breed , age, name) + @age = age + @colour = + @breed = breed + @name = name + + def sit + + end diff --git a/gems.locked b/gems.locked new file mode 100644 index 0000000..72ac24a --- /dev/null +++ b/gems.locked @@ -0,0 +1,10 @@ +GEM + specs: + +PLATFORMS + ruby + +DEPENDENCIES + +BUNDLED WITH + 1.15.3 diff --git a/gems.rb b/gems.rb new file mode 100644 index 0000000..6db79bf --- /dev/null +++ b/gems.rb @@ -0,0 +1,4 @@ +require 'artii' + +a = Artii::Base.new :font => 'slant' +puts a.asciify("WAZZZUUUUUUPPP!!") diff --git a/penis_program/1.8.0 b/penis_program/1.8.0 new file mode 100644 index 0000000..e69de29 diff --git a/penis_program/3classes_app b/penis_program/3classes_app new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/penis_program/3classes_app @@ -0,0 +1 @@ + diff --git a/penis_program/3classes_app.rb b/penis_program/3classes_app.rb new file mode 100644 index 0000000..c944beb --- /dev/null +++ b/penis_program/3classes_app.rb @@ -0,0 +1,40 @@ +#build an app that solves a problem +#with 3 classes +#one gem +#ever wanted to solve the problem of your friends being not funny, +#they can't yo mama you when your mamadeserves it + + +#create classes that consists of the level of harassment of a yommama joke you wanted +#choices of easy, medium, hard +class begin_the_crazy + def initialize(easy, medium, hardcore) + @easy_harassment = easy + @medium_harassment= medium + @hardcore_harassment = hardcore + end + +class easy_harassment + def easy(fat, ugly, dumb) + @fat = fat + @ugly = ugly + @dumb = dumb + end +#fat when dracula sucked her blood, he got diabetes +#ugly bob the builder saw her and said "I can't fix that" +#old so old that when she farts, dust comes out + +class medium_harassment + def medium(whore, hairy, stupid) +#fat when she died she broke the stairway to heaven +#puts hairy, she so hairy you got carpet burn when she gave birth to you +#puts ugly when she looked out of the window, she got arrested for mooning + +class hardcore_harassment + def hardcore() + +#fat when she pressed up on an elevator, it goes down +#old when I told her to act her age, she died + + +puts "You little shit, you want to be harassed by yo mama's fat, ugly or dumb ass?" diff --git a/penis_program/recipe_generetor.rb b/penis_program/recipe_generetor.rb new file mode 100644 index 0000000..43713d4 --- /dev/null +++ b/penis_program/recipe_generetor.rb @@ -0,0 +1,39 @@ +#_app_id = 8761fe27 +#_app_key = eb9bc332198f1609d3f41f6e426fc670 +# config/initializers/yummly.rb +require 'httparty' + + require 'yummly' + +Yummly.configure do |config| + config.app_id = "8761fe27" + config.app_key = "eb9bc332198f1609d3f41f6e426fc670" + config.use_ssl = true # Default is false +end + +result = Yummly.search('carrot') + +#puts 10 recipe names with that keyword +puts result.collect { |recipe| recipe.name} +#puts result.total # returns 43350 +#puts result.size(10) # returns 10 + +#have user pick one option +#display the options with array index visible +#gets.chomp users option into a variable .to_i +# get the receipe name and url +# display the ingredients for that one recipe +##{} + + + +#url = "" +#result2 = Yummly.search('carrot') + +puts result2.collect {|recipe| recipe.ingredients} + + +#puts result.collect { |recipe| recipe.ingredients} + + +#/s"hello" diff --git a/penis_program/review.rb b/penis_program/review.rb new file mode 100644 index 0000000..e69de29 diff --git a/penis_program/review2.rb b/penis_program/review2.rb new file mode 100644 index 0000000..9aede3a --- /dev/null +++ b/penis_program/review2.rb @@ -0,0 +1,125 @@ + +#this is a comment + +apples = 5 + +name = "omar1" #any character "" + + +good_laa = ["hdhdd", "wuswu"] + + + +countries_that_sell_arms_to_saudis = ["Canada", "divided_states_of_murica"] + +countries_that_sell_arms_to_saudis.insert(2, "Britain") +countries_that_sell_arms_to_saudis.delete_at(1) + + +puts countries_that_sell_arms_to_saudis + +#while loops +i = 0 +while i <= 5 + puts i + i = i + 1 +end + +#do loops +goals =+ 1 + +loop do + goals += 1 + puts "you scored" + break if goals > 5 +end + +puts "you won" + +#each loops +["tom", "dick", "harry", "ghoul"].each do |name| + if name.start_with?("g") + puts "Hello, #{name}" + else + puts "error" + end +end + +#switch cases, more than 2 options +capacity = 20 +case capacity + when 0 + puts "You ran out of petrol" + when 1..20 + puts "hurry fill up" + when 21..70 + puts "You running good" + else + puts "Error, invalid value, Fuck off! (#{capacity})" +end + + +#blocks +def my_block + puts "step 1" + yield #break + puts "steps 3" +end + +my_block do + puts "step 2" +end + +#letters = ["a", "b", "c"] +#puts letters[1] + +##ARRAYS +friends = {"key" => "value", "key2" => "value2"} +=begin +dan = {"forest lodge" => "123 fake steet", "3829849" => "ahhhaahs.org"} +dictionary = {"facacious" => "exaggerating something", => "canada" => "a magical place"} +puts dictionary.["facacious"] + +puts dictionary +dictionary.delete("canadia") + puts dictionary + puts dictionary.length + + dictionary.clear + + dictionary["cat"] = "new animal" + +puts dictionary +=end +a = "a letter" +b = "a letter" +c = :a_letter +d = :a_letter + +#tinder app +user_1 = {:swipe => "left", "swipe" => "right"} #shit long code +user_2 = {swipe:"left", swipe:"right"} + +puts user_2 + +luke = {:ssn => "238384747"} + +puts luke.ssn +#use blocks, get.chomp, yield +#create a choose your own adventure +#wake up +#choose torch, knife or banana +##if torch, puts you've turn it on, choose move towards bushy area or one with faint sounds +##a spider is on your face +##do you leave it as your new pet, or slap your face trying to get it. +## you now are dead, the spider is poisonous, +##and you slapped yourself unconcious and lions have eaten you +###if knife +###choose move forward, or bend over to look for other items +###if move forward, you've see a faint light and feel domething on your leg, +### do you walk towards the light or check to see what is on your Feet +### the knife has a lifeforce and started stabbing you, you're dead +####if banana +#### choose do you eat banana because you are hungry or move forward +#### your choices totally mattered, lions nearby smelt the banana and have eaten you, +####your dead, if you moved forward they smelt that you have a banana and have eaten you diff --git a/penis_program/the_penis.rb b/penis_program/the_penis.rb new file mode 100644 index 0000000..5a10bf5 --- /dev/null +++ b/penis_program/the_penis.rb @@ -0,0 +1,17 @@ + +def show(size = "small") + case size + when "small" + "8=D" + when "medium" + "8==D" + when "large" + "8====D" + when "super_large" + "8=======D" + when "kevin" + "8========================================================D" + end +end + +puts show("kevin") diff --git a/restaurant_class.rb b/restaurant_class.rb new file mode 100644 index 0000000..51259e4 --- /dev/null +++ b/restaurant_class.rb @@ -0,0 +1,74 @@ +# I run a restaurant and am rich, wants to be richer +# 1 want to be richer. My staff costs $3 an hair_colour +#Write some code to let me fire them + +=begin class Robot_service + + attr_accessor :burgers, :chips, :drink, :flurries + + #give class info on what it is doing + def initialize(burgers, chips, drink, flurries) + @burgers = burgers#chicken, lamb, or veggie because you're a hippy + @chips = chips#potato or sweet potato + @drink = drink#orange, cocaine, some sugar_filled_shit + @flurries = flurries#oreo because I can code now and have the munchies + end + + def order(order) + puts "You've ordered #{@burgers}, #{@chips}, #{@drink}, #{@flurries}, Now pay or I'll fucking kill you!" + sleep(3) + system("clear") + end + + # # IMPORTANT: The getter and setter methods below for `burgers` + # # are automatically generated when we typed up the top + # # in the class `attr_accessor :burgers` + # + #getter + ##def burgers + #return @burgers + #end + # + #setter + #def burgers=(burgers) + # @burgers = burgers + #end + +end + +order_for_clownface = Robot_service.new("chicken", "maccas chips", "Fresh OJ", "Oreo") +# puts order_for_clownface.order(1) + +# puts order_for_clownface.methods +order_for_clownface.burgers = ("vegie") +order_for_clownface.order(1) +=end + +#Greeting +puts "Welcome to shitsandwich! How may we shit in your food today?" +puts "Lets start with burgers, type 'fresh from a goats ass poo or FFAGAP, matured sun-dried poo or MSP, diarrohea or D'" +the_answer1 = gets.chomp +if +the_answer1 == 'FFAGAP';'MSP';'D'; +puts"What drink would you like? We are exclusively offering pee or P, goats milk or GM" +the_answer2 = gets.chomp +if +the_answer2 == 'P'; 'GM'; +puts "Thank you, I am a robot and even I hate you!" + +else + puts "fuck off" +end +end +# burgers = gets.chomp.uppercase +#{} + + + + + + + + + +# puts order_for_clownface.burgers diff --git a/shopping_list b/shopping_list new file mode 160000 index 0000000..8aede17 --- /dev/null +++ b/shopping_list @@ -0,0 +1 @@ +Subproject commit 8aede175eb89c6c26b4271a8fba3525e944dd293