If you find yourself typing out the path of a file multiple times, I recommend using the below shortcut in you Key Bindings. Sublime is a powerful IDE and has many shortcuts and tools hidden in it.
I was unaware of Key Bindings but happy to have found this thanks to my coworker @robdel12.
{ "keys": ["super+ctrl+f"], "command": "copy_path" }
This is my personal blog and journey in learning a new skill, Web Developing. In only 7 months I made a career change into this field by dedicating 25(avg) hours a week in studying Ruby. #All words are my own, except the ones I copy and pasted.
Monday, August 11, 2014
email validations for arrays in rails
Sometimes things just aren't that easy. Rails is definitely nice when you do everything out of the box and do not veer to far from the path; I am quickly finding that there are some things that are difficult figure out.
For example I had a task late afternoon to validate emails that are stored in an Array. I original stored all emails as strings but due to way the Rails Mailer works and the needs of the application, the emails are now being collected using CSV(separate by commas) in a string. I am easily able to split that string using split(",") and serializing that into an array. I am also handling single emails by converting them using the Rails method Array.wrap(). Those 2 methods could be blog post in their selves but I am opting to just explain my next issue.
The trouble with storing the emails in an Array is that it broke all my email validations, which does not check a string of emails, I now am tasked with testing the validations by hand, after discovering that the Active Validator only validates strings.
Validate an array of emails.
emails: ["ilikerobot[at]gmail.com, hello[at]briandouglas.me"]
emails.split(",")
emails: ["ilikerobot[at]gmail.com", "hello[at]briandouglas.me"]
With this being my first major case where Rails couldn't do what, I am considering looking at the Active Validator to see if I can contribute to it and add this functionality, but it might be better as a gem. I am sure it would take longer than a night to implement but it could be a cool challenge to create my first gem and this idea seems simple enough.
My first implementation:
My final implementation *after peer review, it turned out I wrote too much code just to check for the validation of an email :)
I also did the same validation in Javascript, on the client-side.
For example I had a task late afternoon to validate emails that are stored in an Array. I original stored all emails as strings but due to way the Rails Mailer works and the needs of the application, the emails are now being collected using CSV(separate by commas) in a string. I am easily able to split that string using split(",") and serializing that into an array. I am also handling single emails by converting them using the Rails method Array.wrap(). Those 2 methods could be blog post in their selves but I am opting to just explain my next issue.
The trouble with storing the emails in an Array is that it broke all my email validations, which does not check a string of emails, I now am tasked with testing the validations by hand, after discovering that the Active Validator only validates strings.
Validate an array of emails.
emails: ["ilikerobot[at]gmail.com, hello[at]briandouglas.me"]
emails.split(",")
emails: ["ilikerobot[at]gmail.com", "hello[at]briandouglas.me"]
With this being my first major case where Rails couldn't do what, I am considering looking at the Active Validator to see if I can contribute to it and add this functionality, but it might be better as a gem. I am sure it would take longer than a night to implement but it could be a cool challenge to create my first gem and this idea seems simple enough.
My first implementation:
My final implementation *after peer review, it turned out I wrote too much code just to check for the validation of an email :)
I also did the same validation in Javascript, on the client-side.
Wednesday, August 6, 2014
Network tab in console
Nothing worse than silent errors on in your app. Javascript and the client-side portion has been notorious for silently failing errors. I was told about the network in the chrome console and it had been very helpful as of late.
I was recently tasked with feature of adding a modal to the site for extra functionality. I implemented the route, controller, and new template but found the submit button had not functionality. In order to see the error I was either calling the page directly or turning off the modal to render the new page in a new tab.
My colleague noticed my mistake while I was pairing and recommended that I use the "Network" tab in the console. I have never been comfortable with the chrome console and was unaware of it powerful glory.
The network gives you a lot of information on what page is talking to which. I was able to find the error and even view it in the tab. The error itself was a simple routing error, which I will hopefully fix this morning, but wanted to take the time and share for future reference.
Code School is currently offering a course preview for the Chrome Dev Tools. I have gone through some of it and it has been very helpful in my day to day at work.
I was recently tasked with feature of adding a modal to the site for extra functionality. I implemented the route, controller, and new template but found the submit button had not functionality. In order to see the error I was either calling the page directly or turning off the modal to render the new page in a new tab.
My colleague noticed my mistake while I was pairing and recommended that I use the "Network" tab in the console. I have never been comfortable with the chrome console and was unaware of it powerful glory.
The network gives you a lot of information on what page is talking to which. I was able to find the error and even view it in the tab. The error itself was a simple routing error, which I will hopefully fix this morning, but wanted to take the time and share for future reference.
Code School is currently offering a course preview for the Chrome Dev Tools. I have gone through some of it and it has been very helpful in my day to day at work.
scope searching methods
I have been just over 10 months in Rails and ActiveRecord, but I just learned a tool I wish I would of known months ago.
I have seen scoped used in projects and even used them unknowingly, but I can say I understand them thanks to an explanation from a treehouse video.
The most likely use for this searching the table with shortcuts. If you find yourself searching in the console multiple times for the same records, it might be useful to set a scope in the model.
scope :premier, -> { where{"employees > ? , 50" )}
This premier scope can now be used People.premier.all in order to filter the search to only employees over the number 50. If you know SQL based commands well, you can change it and make different focuses. This might not as apparently useful now, but my recommendation to keep this tip in the back of your mind next time you find yourself all up in the console.
I plan to complete the Treehouse DB section to become a little more familiar with the SQL commands. I have attempted to jump in DB's in the past but fell asleep, due to it being so boring. Hopefully treehouse will excite me....
I have seen scoped used in projects and even used them unknowingly, but I can say I understand them thanks to an explanation from a treehouse video.
The most likely use for this searching the table with shortcuts. If you find yourself searching in the console multiple times for the same records, it might be useful to set a scope in the model.
scope :premier, -> { where{"employees > ? , 50" )}
This premier scope can now be used People.premier.all in order to filter the search to only employees over the number 50. If you know SQL based commands well, you can change it and make different focuses. This might not as apparently useful now, but my recommendation to keep this tip in the back of your mind next time you find yourself all up in the console.
I plan to complete the Treehouse DB section to become a little more familiar with the SQL commands. I have attempted to jump in DB's in the past but fell asleep, due to it being so boring. Hopefully treehouse will excite me....
Monday, August 4, 2014
Well Grounded Rubyist part 1
I had a lot of fun preparing some slide for the WGR book club I am hosting. It is definitely helping me understand the material by forcing my self to discuss via hangout.
For those insterested the slides and vide are below.
Next hangout is in 2 weeks.
For those insterested the slides and vide are below.
Next hangout is in 2 weeks.
Saturday, August 2, 2014
CatchUpConf2014
I have recently figured out that you can listen to Youtube videos at 2x without added extensions or downloading them locally. This is a great discovery for me since I have been collecting conference talks for a while but find I never finish them due to lack of time.
When I first starting learning Ruby, I watched youtube videos at 4am while holding my newborn son. We had a great system, but he has now sleeps in and I have gotten lazy too.
I am now collecting more conference videos to watch now at 2x and open for suggestions. I have created a public Youtube playlist called CatchUpConf of videos I have had on my list already, but also some I would like to rewatch and hopefully learn some new info on Ruby and other languages.
If you have not watched the Advi Grimm talk on Confident Code, I highly recommend it.
When I first starting learning Ruby, I watched youtube videos at 4am while holding my newborn son. We had a great system, but he has now sleeps in and I have gotten lazy too.
I am now collecting more conference videos to watch now at 2x and open for suggestions. I have created a public Youtube playlist called CatchUpConf of videos I have had on my list already, but also some I would like to rewatch and hopefully learn some new info on Ruby and other languages.
If you have not watched the Advi Grimm talk on Confident Code, I highly recommend it.
Friday, August 1, 2014
Going through the basics
I spent the majority of my time learning Ruby/Rails, I had the assumption I knew how to perform basic things in HTML/CSS and have always been able to Google enough to get by.
Recently I have begun a speed tour through also of the Treehouse Curriculum learning a lot of new things I thought I was an expert on. They recently announced a new Ruby basic section which I completed in its entirety in less than 2 hours. I found even though I already knew most of the content, it was a great review. I also enjoy the teaching style which aloud me to sharpen my skills in the post lecture challenges.
In addition to Ruby I have been working my way quickly through HTML/CSS. A lot of the HTML I didn't know how to do has since been deprecated, which they mentioned, but I never went through a formal course on CSS.
I understood the basic concepts of id's and classes, but not really. I have had a lot of aha moments and really appreciating this opportunity to go through this info. With only being 2 weeks into my free membership, I plan to complete all of the Javascript course and workshop, as well the Ruby, iOS, and HTML/CSS sections.
What actually has been helping is going through all the courses at 2x speed during my lunch break which allows me to knock a section or more a day. If you have not tried treehouse, I believe there are free 7 day trials available if you google hard enough, but if not the below picture is a link to get 50% off.
In just one month I will probably have completed the majority of my desire learning through Treehouse. I plan to do something very similar with Code School. I have neglecting learning the basic fundamentals in web development and Treehouse has been a great fit, in addition to the books I have been reading on the side (WGR and Confident Ruby).
*If you live in Orlando or come other cities you can a free membership via your local library.

Recently I have begun a speed tour through also of the Treehouse Curriculum learning a lot of new things I thought I was an expert on. They recently announced a new Ruby basic section which I completed in its entirety in less than 2 hours. I found even though I already knew most of the content, it was a great review. I also enjoy the teaching style which aloud me to sharpen my skills in the post lecture challenges.
In addition to Ruby I have been working my way quickly through HTML/CSS. A lot of the HTML I didn't know how to do has since been deprecated, which they mentioned, but I never went through a formal course on CSS.
I understood the basic concepts of id's and classes, but not really. I have had a lot of aha moments and really appreciating this opportunity to go through this info. With only being 2 weeks into my free membership, I plan to complete all of the Javascript course and workshop, as well the Ruby, iOS, and HTML/CSS sections.
What actually has been helping is going through all the courses at 2x speed during my lunch break which allows me to knock a section or more a day. If you have not tried treehouse, I believe there are free 7 day trials available if you google hard enough, but if not the below picture is a link to get 50% off.
In just one month I will probably have completed the majority of my desire learning through Treehouse. I plan to do something very similar with Code School. I have neglecting learning the basic fundamentals in web development and Treehouse has been a great fit, in addition to the books I have been reading on the side (WGR and Confident Ruby).
*If you live in Orlando or come other cities you can a free membership via your local library.
Subscribe to:
Posts (Atom)





