I recently finished my project called: http://www.brau-brett.de I wasn't aware of the possibilities on how to create just a basic search function within my jobs database. I've found a neat little tutorial on how to do it without using any gem but raw sql. I started by impelmenting a searchfield into the index jobs index … Continue reading Raw SQL for search bar
I've watched a great video on Youtube about Testing, by the awesome Sandi Metz. I really like her style when shes holding speeches at Ruby Cons. I think the whole Testing thing is really important for every developer so I give it a try and summarize what she said. Testing Alot of programmers dont bother … Continue reading Rails Conf 2013: The Magic Tricks of Testing by Sandi Metz
Inheritance is basically one class that takes features from a parent class like: class Bear < Animals. so every thing I do in the instance of the Bear class, would also work as if they were done to an instance of Animals. It lets us do common functionalities in the Animals class and be more specific … Continue reading Learn Ruby the Hard Way: What is Inheritance?
Rules for If-statements mandatory else-statement if else-statment never runs, because it doesnt make sense, there need to be a die function, that prints out an error message and closes afterwards Don't nest if-statements more than 2 deep Treat if-statements like paragraphs, where each if-elsif-else grouping is like a set of sentences. Put blank lines before and … Continue reading Ruby the Hard Way: Designing and Debugging
I set myself a challenge: learn programming every day, except weekends, for at least 5 hours. The reason behind this, was me beeing distracted by timeconsuming stuff like gaming, youtube and social media. I really want to prove to myself, that I can push through it and learn the stuff as soon as possible. Let's … Continue reading Learn ruby the hard way: the hard way!
Okay this one, was a tough one: module Ex25 # This function will break up words for me. def Ex25.break_words(stuff) words = stuff.split(' ') return words end #sorts the words def Ex25.sort_words(words) return words.sort end #Prints the first word after shifting it off def Ex25.print_first_word(words) word = words.shift puts word end #Prints the … Continue reading More testing
input_file = ARGV.first #the first file name is typed in is input_file def print_all(f) #f in this case is a variable but also a file puts f.read end def rewind(f) f.seek(0) #f.seek(0) moves to the start of the file >> to 0 bytes of the file end def print_a_line(line_count, f) … Continue reading Functions and Files