The Rails 4 Way

I just bought the Rails 4 way beta on leanpubs. The book is in beta and said to be about 75% complete.  I’m going to work through this book in a non chronological order that suits my prior knowledge of Rails itself.

At this point in time my knowledge of Rails is limited. I’m aware of how to create a rails application. I’m know that generating a scaffold will create a model, a controller with all the CRUD you can ask for, and a view. Scaffolds also create your schema and test folders. I have almost no knowledge of testing. I know about the word assert. I know about devise(the user authentication gem). This is the extent of my rails knowledge. I’ve read Learn Agile Web Development with Rails and built rewster.herokuapp.com

With my previous knowledge I’ve went over the chapters and decided to read them in an order than I can work off of best. I’m going to read then in this order because for a couple reasons. The first being that simply brushing up on testing is important to me, testing, then I’d like a refresher in HAML, SASS, and CoffeeScript, followed by perusing the chapters about security, sessions and authorization, and the basics of the Rails architecture.

I’ll be applying all of this into my own application sometime during or directly after reading about the rails architecture. From there, In my spare time I will continue reading the more foreign(to me) chapters of this book that aren’t immediately necessary to understand in order to get up and running. I’m definitely not counting them as unimportant. I just don’t want to clog my brain or waste my time with things that I won’t be implementing at that time. When I need to implement them I will be reading about them very carefully.

If you’re new to Rails I would suggest reading chapters 1-10 first then following my guide in the order I’ve selected.

Danny’s Rails 4 way reading guide – 27, 22-24, 15, 13-14, 1-10||, 12, 20, 17, 26, 11, 18-19, 25, 16

Advertisements

Hack Reactor Interview #2

Hi guys,

2 days ago I had my first interview with hack reactor and dev bootcamp. That night I got an email from dev bootcamp telling me I got accepted. This took me by surprise. So I need to pay a 1000 deposit within the week and come up with 11000 sometime around feb ’14(60 days before next class starts). This is barely doable, I’m getting the 1000 together but still working hard on my other schools.

The learning involved in preparing for these schools has helped me nail down basics to a degree far better than code school, codecademy and books have given me. I had my second interview today with Shawn Drost. The interview was set up in a way similar to as if it were the first 30 minutes of the first day. He was working with me to see if I understood exactly WHAT each function was doing, what it was or was not returning. WHY it was doing it. At the end of it he asked me to just work on coderbyte problems. He said I have the syntax down, I just need to work my understanding, break everything down into little steps and really understand what the computer is doing when you tell it what to do.

I have one thing to say about hack reactor. They LOVE teaching. Money aside, I want to go to this school do to the fact that it is a school that loves teaching, not just making money. I’ve got an interview with Code Fellows in Seattle. If I can get into their gold program and completely skip the first half, then I absolutely will(4 wks/ $5000/ guarantee of job). I’m going to brush up on all my rails knowledge in prep for that interview. After that interview I will be working on coderbyte problems for the next week and I’ll set up another interview. 

A lot has gone on this week and a lot will continue to go on next week. I’ll keep you guys up to date. 

Adios.

Interviews!

Today was great, I love talking to like minded tech people. My wife is a make up artist and my baby is 9 months old. So I hear a lot about lip gloss, lip stick, lip tar, lip stain, kabuki brush, and contouring as well as lots of dadadadada’s and oooooo’s. These are all very interesting and I love hearing them all, but talking to someone about programming and problem solving is a bit more engaging :D. 

My first interview was at 10:45 with Hack Reactor. It was with a HR alumni who is now in a continuation/TA type program. He set up a collabedit.com session and had me solve 3 very basic problems with javascript. We spoke a bit about programming and different technology things after the interview. We spoke for about 50 minutes, I’d say the interview part was only about 20 minutes though. He said the next step would be to have me complete a project(which Marcus Phillips already challenged me with 2 weeks before). I informed him I’ve solved that twice now, the first time I cheated after getting stuck for to long and found the answer online(its no longer online after I informed marcus I cheated). A week later after forgetting everything I “learned” while cheating, I solved it again and gained a lot more knowledge out of it. I’m rambling…. So we decided to skip the project and move onto scheduling my next interview. “We have a slot available tomorrow”, no can do, gotta go to Reno with the family, “day after that?”, absolutely! I’ll be reviewing that project I built and some js syntax tonight and tomorrow night and then I’ll provide a new post.

Dev bootcamp was great to, I spoke with Karim and he was easy to talk to. He had me solve a puzzle, this was not a programming puzzle, this was just to see how I solve problems. I tried to talk out loud as much as possible and was afraid to lean on his guidance. This may or may not have been a good thing. He wasn’t going to tell me what to do or how to solve it after all. I didn’t solve it, we moved onto code samples. I did fine on the code samples. After finishing up I concluding he was multitasking. This lead to him be a little distracted during our interview. He was a very cool and polite person, though I do have a history with customer service and found the distraction to be a bit impolite. He finished up by asking if I had any further questions and informed me I would be contacted within 12 hours. 12 seems like a weird number and now I’m assuming he said 24, but I’m pretty sure I heard 12 😀

 

All in all, I enjoyed the interview, tomorrow is a day off(mostly, I’m still going to review my project code for the HR interview). I’ll update you all after my interview on thursday. 

Happy Coding!

Can’t wait to progress

This last month has been great and not so great when I look back on it. I’ve been just crunching on the basics. I didn’t really improve my rails, or my javascript(kind of). Really I just didn’t learn new things. 

Instead I’ve been nailing down simple string and array manipulation, getting a lot faster at solving problems, and have the common methods stuck in my head, I’ve touched a little on new things like API’s, underscore.js(thanks to JavaScript koans), and I have a free month of CodeSchool thanks to New Relic so I’ve been reviewing classes on there. I’m really just trying to get as fast as possible with beginner problems in order to do well in my Hack Reactor and Dev Bootcamp Interview. In the last week it’s been getting old though. I want to finish rewster.herokuapp.com. This is why I feel like its just been bad.

My mentor has been busy working a lot this last month, and I got a chance to chat with him the other day and update him on what I’ve been doing and he put it this way

    “you seem to be doing a lot of hand-holding type stuff

        books, tutorials, guides

        that’s fine. but that’s not how you learn to write code”

And that’s how I’ve been feeling. As great as this last month was in helping me think logically and help me solve simple basic problems fast, I’m ready for the real challenging stuff with new information constantly being forced through my brain.

If any of you are on a similar learning path with similar “self taught programmer” goals, maybe you’ve heard of Joshua Kemp. He has a very extensive blog about his journey. Also after 9 months averaging 21hrs/wk he got a great job. Awesome success story. Check him out at http://www.joshuakemp.net/.

His blog kind of inspired me to do mine. After revisiting his blog it made me realize I don’t post enough. I’ll try to get my brain on this site more for you all.

Wish me luck on my interviews.

Rubeque string substitution

 

 

 

 

I’ve decided to start sharing how I solve problems occasionally on this blog. I think this will be helpful for potential employers to see how I work.

The following picture is of a Rubeque.com problem

Screen Shot 2013-08-22 at 1.57.57 PM

So we want to substitute the matched pattern of a string within the main string, for a new string. Lets start with making the pattern and actual regular expression.

pattern = Regexp.new(pattern)

This Regexp will be used in Strings sub method(String#sub) in order to replace the matched contents of a string into the replacement parameters value,

self.sub(pattern,replace)

Well that was easy, the first case passes, but the second one doesn’t. This is because sub only replaces the first matched instance it finds. Instead we’ll use String#gsub, for global sub. This will replace all instances of the matched data.

self.gsub(pattern,replace)

That makes the next test pass, however, we’re having issues with getting the string “??” to work like we want it to as a regular expression. This is because ? is a special character used inside regular expressions(It matches either one or none of the preceding character). http://rubular.com/ is a great way to check and or just reference ruby regular expressions. So we need to escape these characters.  We can do this with Regexp.escape(pattern), this “Escapes any characters that would have special meaning in a regular expression. Returns a new escaped string” (taken from ruby-docs). So instead of .new we will use .escape right? No, if you look closely at that definition, .escape returns a string, we still need pattern to be a regexp. So we will make it work like this:

pattern = Regexp.new(Regexp.escape(pattern))

That’s a lot better, now we only have the last test case to solve. our last test case replaces the matched data with a string that contains special substitution cases. ex: \1, \2, \3. These cases will return the exact Match data returned from the regexp. \1 return the first matched case, \2 return the second, and so on. How do we get this to just return \2. we can’t escape the use Regexp.escape(replace), that will just return silly backslashes all over the place. Instead we have to look closer at String#sub and String#gsub. “The problem is that when using sub (and gsub), without a block, ruby interprets special character sequences in the replacement parameter” this quote was taken from two-bit-fool’s answer on Stack Overflow. So when ruby sees the replacement parameter it just INTERPRETS the \1\2\3 and does some magic. We don’t want that, so lets put the replacement string into a block instead of letting it be a paramter.

self.gsub(pattern) { replace}

Now everything is passing! So this is how I solved that question. However, Lets do some recursion on this and  shorten this up a bit with regexp interpolation. With pattern we could do what we did, or we could just create a regexp and interpolate the string returned from .escape like so

pattern = /#{Regexp.escape(pattern)}/

That’s easy enough to understand, and its short enough that I think it could go on the same line, and we can skip redefining the pattern variable all together. So to sum it all up, my final answer was this:

self.gsub(/#{Regexp.escape(pattern)}/ ) {replace}  

I simplified this a little better, I skipped some steps in my head but thought this would clear up how I solved each assertion.

Learning Path plan/idea

So I have a plan, but I can’t accomplish this plan on my own. I’ve been looking at in-class short-term developer schools like dev bootcamp, hack reactor, Epicodus, and schools alike. I haven’t been just looking, I’ve read just about every quora.com post on every school in the U.S. and I’ve concluding some similarities between them all.

They all put extremely motivated, dedicated individuals in the same place in a pair programming environment and teach very similar coursework. The only major difference between them is they have different teachers in a different building. My proposition is to find a candidate that has a similar schedule as me, and is looking to follow the same curriculum Epicodus uses for the first 3-4 weeks. This curriculum teaches Programming basics like TDD, OOD, and working with API’s. It also goes into HTML/CSS basics, JavaScript ,  and jQuery. The curriculum can be found at www.learnhowtoprogram.com

His school, like many of the others, goes on to teach Ruby, Rails, Backbone||Ember, and git. I’ve requested more curriculum from him in these areas of study, and even If he is not willing to provide resources, I am confident there are a multitude of great resources available in terms of beginner curriculum in those areas of study.

Here is my summarized plan in steps:

-Find a dedicated individual with a similar schedule and like mind to do 20-40hrs/wks of remote pair programming along side a google hangouts or Skype session.

Week 1-4 : follow the same curriculum Epicodus students go through, provided on www.learnhowtoprogram.com/

Week 5-8 : If Michael at Epicodus provides additional course curriculum, we will follow that,(update: Michael has stated he plans to update his course work fairly often so that individuals like me who want to learn, can do so. |http://qr.ae/IimuX|), Otherwise we will go through various popular resources like Chris Pines learn to program, http://ruby.railstutorial.org/ by Michael Hartl, RailsCasts, and a couple popular books on Rails. I will layout a curriculum that is 20% reading 80% actual coding(together remotely).

– week 9-12ish : each of us will have our own project we want to build, something challenging, but not over the top, takes a team of developers and a whole year to complete type of challenging. We will work on each others projects together, switching back and forth, each day.

If working together in a remote environment consistently on a mutual schedule under the provided curriculum sounds like an awesome idea to you, then I ask, Please contact me. I will be going through a sort of application process to make sure we are both a good match for each other. I’ll be checking to make sure you and I can get along, you can commit to the time, and that you are passionate about learning the discussed web technologies.

Contact me @ danny.sperry@gmail.com

Progress

Waiting till the 27th for my interview with both dev bootcamp and hack reactor. The more I think about it the more I want to get into hack reactor. I just have this urge to learn node.js, my mentor is a rails advocate and is all about rails, but something inside me tells me node.js is got it’s own special place in the future. Plus HR teaches a little bit about RoR.

Project Euler has been pretty good. I’m stuck on number 12 right now. The coding part isn’t hard on PE, its getting a efficient algorithm coded that really messes with you. For example, the third problem wanted the factorials of 600,851,475,143. My original calculation would have completed that in 3 years(not kidding). I refactored the code to:

remainder = self
answer = []
(2..(Math.sqrt(remainder))).to_a.reverse.each do |x|
if remainder % x == 0 && x.prime?
answer << x
remainder /= x
remainder.factorials
end
end
answer

This completed the calculation in 0.2s, That right there showed me that what I was doing was something big towards my future in programming. This is the first time I felt like the non-sense people talk about learning during CS degrees does come in handy once the basics are learned. Algorithms are no joke people! :D.

On the ASL side of things, This week I learned the words father, grandfather, mother, grandmother, daughter, son, church, earth, sky, aunt, uncle, eat, milk, love, and sorry. plus A-Z.

Also, I checked my typing speed and it is 90 AWPM. My typing speed with coding is sad though. only 30 AWPM :/. So in the weeks to come I’m working on Project Euler algorithms with Ruby, and I’m just engraving JavaScript basics like common array and string methods, as well as syntax so that I can have a leg up in my HR interview in a couple weeks.

Also, dannysperry.com is mostly finished with a few bugs and my quiz is updated with new questions a little more functionality.

I’ll keep ya’ll posted