bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Sunday, November 30, 2014

What ever happened to Chuych

I spent a good amount of my learning Rails while hacking away at an idea I had to find churches easier. This idea for a church app was actually the reason that got me started in this journey in the first place, but this app been rejected in the past mont

Back in August I rewrote a lot of the Rails code and even added test for the functionality. I then began learning a lot of new front end techniques and frameworks to eventually redesign the app from the ground up, but I got distracted.

I first got distracted just learning and recently realized I was not spending nearly enough time writing code. The fastest I have ever learned code is by writing it and I have made the decision get back into making apps. I have spent nearly 15hours of logged time rebuilding the design using a bootstrap template ( I was avoiding using bootstrap, but gave in).  I now have an app that I am proud of and looking forward to sharing it with actual users.

The irony is that this has been complete for nearly 8 months, but I have been dragging my feet to actually share it and have people use. It's one thing to build an app, but its much nicer to have real people use it, which I have found joy with in RubyNewbies.

I have been putting git flow into practice and focusing one feature at a time, I did not spend my time in TDD as much as I like to since the majority of changes were CSS and not backend. I also set my integration test to pending during that time since I did not have a design in mind, I look forward to going back and rewriting those.

Look out for more post about my rewrite of this app coming soon, specifically the challenges of maintaining an app with legacy code.

Before:

After:



ember CLI install and murdering my node

Never ever ever sudo with npm installs. I did not know this and probably unknowingly did this all the time. In my early days in Rails I never had an issue, only because once you install Rails it's stalled and be upgraded in the Gemfile. With Javascript, I am quickly finding that a lot of things require the node package manager (npm) to install and upgrade. I recently upgraded my ember to use the ember-cli, came across this sudo errors, but thanks to this homebrew issue thread I was eventually able to solve my problem.

My solution included this premade bash script called "murdering your node." From there I could clean install node and ember-cli.

If you are interested in learning Ember I suggest starting with the ember-cli-101 book. It is hands down the best Ember tutorial I have done and has gotten me pass some of the toughest hurdles I have faced in learning a Javascript MVC framework on my own.

*FYI: just to be clear you can sudo your way through npm, but it is not recommended, especially with ember-cli.

Tuesday, November 25, 2014

I am IZEA (video)



The company does a lot of work web influencers and bloggers in the social media space and has created a number of showcase what IZEA is all about. I was approached as an employee of IZEA to be the focus in one of them and would like to share it with all the readers of my blog.

The posts on this blog is a representation of the hard work I put in to finally get a job as a Ruby on Rails engineer. Thank you for all the support you have given me while I have been on this journey.

Monday, November 24, 2014

git commit -v

Everyday I use vim I get a little better at it, and actually surprised on how fast I have progressed this past week. My hesitation to jump right in was unfortunately the only thing preventing me from really learning it.

The best that help break my timidness in vim was writing my commit messages us the vim IDE. The common way of commit work is using `git commit -m`, but I recently found out about `git commit -v` from an upcase video; Rather than set your message per commit, you are able view the `git diff` and add a commit message while viewing what you changed.

I highly recommend viewing the diff before you create commits, it will help you catch misspellings and prevent debuggers from getting in a pull request.


Thursday, November 20, 2014

Setting up Jasmine TestRunner

Shortly after I wrote my previous post I found this awesome video on getting the Jasmines Test Runner set up. Javascript testing is still a mystery to me when it comes to set up and preferred DSL'a, but it seems as if Jasmine is quite popular and where I will be spending most of my time.

I am also interested in Chai, just because it sounds so good with Mocha

I can't recommend Koans enough

I have basically gone through the majority of Eloquent Javascript, working through problems here and there,  and just about done with it. The book has definitely taken more time to get through than expected, mainly because it is new territory for me. I have found that Javascript is language I have to get hands on writing with, actually Ruby was the same way. I can't just read Eloquent Javascript and pick up the concepts.

I have found great success working through Javascript Koans. The basic form of Koans are simple programming test which you make pass by literally inputting the answer given. I did spend time filling in the answers without looking them up but when I got stuck all I need to do is run the test and read the assertion for help. My explanation of Koans does not give it justice, which is why I highly recommend checking it out for yourself.

Prior to moving to Orlando and taking my job at IZEA, I work through the entirety of Ruby Koans, this helped me learn the syntax of Test::Unit. Previously I only had experience with Rspec and the majority of the testing at my new job was Rspec.

Another thing the Koans taught me was how to write more test. The structure of Javascript and Ruby Koans does not require you to write test, but from reading the already made test it help me understand how to write proper and more extensive test.

Like I said in a previous post, it's hard to be inspired when you never look at the way others do things. If you write Javascript or Ruby and are not testing currently or want to expand your knowledge into testing, download the repos for Ruby and Javascript Koans today.

*Please note there are other types of Koans out there but I feel these are the best introductions into them.


Wednesday, November 12, 2014

My Baby Steps into VIM

I have spent a lot of time attempting to complete the challenging Vim-Adventures, but have found solving the integrated puzzles more challenging actually learning VIM. I am actually still stuck on level 9, I found I needed to learn VIM faster and actually completed vimtutor twice.

Vim-Adventures is definitely one of the best ways to learn muscle memory, as you tend to learn how to move around without even thinking about it. The vimtutor tutorial is definitely one of the best tutorials and covers a lot in a short amount a time. I imagine you can complete the entire tutorial in less than an hour on your first run through.

The entirety of my VIM learning was completed while running the test suite at work, which unfortunately takes about 30mins each time (something we are working on in making better). I decided last week that after spending 2 months learning VIM in small spurts, it was time to actually start using it.

I got a very brief walkthrough after my last TDD  practice session. I got to see tmate.io (actually tmux and not vim, but still a cool tool) working in the wild and even install the JANUS VIM package. Last week I attempted to work on a feature using VIM but quickly found out despite my extensive research and practice, the previous tutorials do not have sections on working through the file system.

I moved on to learning through the free Vimcast and Vim Novice Tutorials which has helped in learning the VIM workflow, like splitting windows and entering and exiting the file system.

I am not yet ready to use VIM at work but I have been working through the Javascript Koans. I am finding that koans is a nice and safe way to learn how much I would rather be using VIM at work. My goal is to switch over when I complete the the entirety of the Koans and become a little more proficient.

If you are at any level interested in try out VIM, either type vimtutor in your terminal or checkout Vim-Adventures. Warning, once you get the initial muscle memory down, you might get addicted.


Wednesday, November 5, 2014

Invalidating text as html with Nokogiri

I am finding a lot of my issues with writing code at work is due to the specific use case of our industry.

I was given the task to add an input box to a form that will allow HTML snippets; these snippets can be a variety of types but of course exclude script tags. I wrote a line of code that validates HTML but it failed QA testing since plain text was allowed to be added to the form. 








This check_html method validates the HTML provided, but it was still allowing plain text, which is a functionality I had to circumvent. I finally came across a hacky solution which was to parse the content using an XML call. After 90 minutes of deliberation I came to this solution:












*note: I was checking for image tags because the XML call specifically disregards the "<img>" tags and requires "<image>", but this worked because it disallowed plain text to be input. I was later informed by my peer that not all XML was valid html and there would not stand the chance of time, I did say this was a hacky solution.

Not proud of this, I submitted my code for peer review and was quickly informed that my attempt was noted but plain text is valid html... Not taking any formal "HTML" course in college I had not known of this fact; All that work to only eventually find out that I was trying to invalidate something that was technically valid.

I was then provided this solution thanks to code review:



Nokogiri parse the HTML and separates each element tag into children and nodes. This code checks to see if thre are any children that have nodes with plain text and finally invalidates those. Like the intro to Star Trek: Enterprise, "It's been a long road".

I hope sharing this will help anyone else in the trying to validate html in put forms, this have proven to be a great learning experience.


Monday, November 3, 2014

My tour with Javascript

I have spent this weekend learning some more Javascript using the book Eloquent Javascript. I have not put as much dedication in learning Javascript until very recently. I have worked through part III of the Javascript Roadtrip on Code School which has been challenging, but not hard I previously thought.

I am finding having a basic understanding in Programming and Ruby makes learning more advanced Javascript a lot easier. I am about to begin chapter 8 and very much enjoying this book and the ability to solve exercises in the browser. I am however, having a lot of trouble just figuring my way around solving problems outside of book. I spent 3 hours on the exercism problem that I solved easily in Ruby.

Learning the Javascript way of doings things has proven to be the challenge. For example I am currently trying to figure out enumeration in Javascript, which is easy in Ruby because I know the name of the standard library methods. I just need to find better sources for looking up Javascript functions, `forEach()`.

Friday was another "hackday" where I spent the entire time working on an app for work called "Beer Club." I am part of a club where we all chip in to buy a new keg for the office and seem to be getting hung up on the voting of a new keg. The app would allow us to add multiple beers to a list to eaily vote on.

I unfortunately started the app in Ember and spent most of the day learning how to play nice with the framework. It was a similar experience when I tried to first learn Rails. The day eventually ran out I restarted the app in just Rails with a basic bootstrap template. I am looking forward to finishing this app for obvious reasons and plan to shoe horn Ember in it once the Rails portion is complete.

My plan is is to now switch my focus away from iOS and put all my learning efforts into Javascript, since it is a tool I use at work and will benefit from a lot sooner.

2014 was the year of Ruby for me, I am thinking 2015 will be full of JS.