A few months back I did a pairing session Chris Hunt and together we built a Node Chat app using the very convenient Getting Started Guide on Socket.io's doc page. We successfully completed the guide and deployed the app with minor hiccups.
Once a month here at work, we take part in a "hack day" where we can work on any project that is vaguely relevant to the business we are in or the company we work for. I took on the challenge to creating a new chat app and possibly implementing as a special feature at work.
One thing I noticed right after completing the app was the lack of user names displayed inline. While chatting with Chris on our app, it was easy to know which messages were not mine, but it would have been nice to know in case I needed to review the history.
Knowing the little node I knew I starting looking into the redis and socket.io-redis npm's and figure thats what I needed to save the username when prompted, but after a bit of time scaling the api and documentation it turned out it was only needed to save the printed chat messages for the session.
I was dissappointed when I did not find a blog post on the subject, but eventually found an old youtube video explaining exactly what I needed to know.
Each user can login with a session or socket and within each socket I needed to save their username. I was actually saving the username to late in the game and every message had the same user's name. I had to access the socket and save the username the same time as the message. Here is an example of the code:
*notice how I am prepending the chat name in the chat message while emitting the socket.
Here is the jQuery providing the chat in my view:
I create a new socket call to save my username that was collect from a javascript prompt and voila, the user's username got displayed each time they printed a message. I am pretty proud that I was able to complete and publish the chat app to heroku in time to present in our hack day presentation meeting.
*I made the dangerous decision of publicly displaying a chat to a projector screen.
As far as redis, I only need that to save the previous chat messages, which for the purpose of my feature, it is not needed. There is still work to be done on the front end and how it will be render to make it a new feature, but I am pretty proud of this little guy - My Chat App.
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.
Saturday, January 31, 2015
Friday, January 30, 2015
Marked HAML
I spent quite some time in my developing learning avoiding HAML, SLIM, and all other template alternatives, but recently I took on the task of working on a project that was exclusively written in HAML.
HAML is a template language that is meant to make writing html less of a drag. It was very common for myself to forget closing brackets and div tags which always annoyed me greatly, but I avoided the simplicity of HAML because I wanted to force myself out of that bad habit. HAML does not require any brackets and works with spacing and indentation to convert the valid html.
I initially reaction when started the project was to convert the existing HAML into/erb right away, but I then read an article from Hashrocket and found they used HAML exclusively and it got me thinking, maybe it's time for start learning this.
What annoyed me the most was the errors received due to the sensitivity of spacing. If your indentation is off HAML will tell you. If you write invalid code, HAML will tell you and there is less flexibility with how much Ruby logic you can place in your template.
Learning Ruby/Rails first introduced me to erb and I love it and understand it, which is another reason why I avoided HAML.
I have since stopped work on this project but did walk away with some more experience in this templating language. I can't say I would go for HAML at the start of a project but I don't think I need to avoid it anymore. I will definitely give it another shot on one for my smaller projects, especially since I am pretty sure this is not the last I will see of it.
If you come across HAML somewhere I recommend learning it and use tools like hamle2erb or htmltohaml
HAML is a template language that is meant to make writing html less of a drag. It was very common for myself to forget closing brackets and div tags which always annoyed me greatly, but I avoided the simplicity of HAML because I wanted to force myself out of that bad habit. HAML does not require any brackets and works with spacing and indentation to convert the valid html.
I initially reaction when started the project was to convert the existing HAML into/erb right away, but I then read an article from Hashrocket and found they used HAML exclusively and it got me thinking, maybe it's time for start learning this.
Here is an example of html converted to haml:
Learning Ruby/Rails first introduced me to erb and I love it and understand it, which is another reason why I avoided HAML.
I have since stopped work on this project but did walk away with some more experience in this templating language. I can't say I would go for HAML at the start of a project but I don't think I need to avoid it anymore. I will definitely give it another shot on one for my smaller projects, especially since I am pretty sure this is not the last I will see of it.
If you come across HAML somewhere I recommend learning it and use tools like hamle2erb or htmltohaml
Wednesday, January 28, 2015
Learn Javascript quickly with WatchMeCode Screencast
A few months back I sent out a tweet to Advi Grimm, trying to find a screencast service similar to Ruby Tapas, but for Javascript (If you write Ruby and do not have a Ruby Tapas subscription, you need to sign up today).
I actually did not get a response but actually got an email from Advi a few weeks later announcing special pricing for Ruby Tapas subscribers to the WatchMeCode screencast from Derek Bailey. I believe I signed up the next day and binged watched almost all the episodes during my 2 weeks off of work.
The videos were slightly longer than a Tapas but filled with a large amount of content on Javascript. I attempted to learn Javascript properly a few times in the last year and failed to grasp the concepts of Prototypes, Closures, etc. Things finally started clicking thanks to this unique form of sharing code through screencast. I would consider myself now moving away from the entry-level to junior programmer and this is thanks to screencast like these who have given the ability to implement new tricks into my development.
I have a couple node projects complete which knocks off one item from my 2015 goals. I now have my eyes on GO and Rust, as well as putting together my first Ruby Gem very soon. Stay Tuned
I actually did not get a response but actually got an email from Advi a few weeks later announcing special pricing for Ruby Tapas subscribers to the WatchMeCode screencast from Derek Bailey. I believe I signed up the next day and binged watched almost all the episodes during my 2 weeks off of work.
The videos were slightly longer than a Tapas but filled with a large amount of content on Javascript. I attempted to learn Javascript properly a few times in the last year and failed to grasp the concepts of Prototypes, Closures, etc. Things finally started clicking thanks to this unique form of sharing code through screencast. I would consider myself now moving away from the entry-level to junior programmer and this is thanks to screencast like these who have given the ability to implement new tricks into my development.
I have a couple node projects complete which knocks off one item from my 2015 goals. I now have my eyes on GO and Rust, as well as putting together my first Ruby Gem very soon. Stay Tuned
Tuesday, January 27, 2015
Custom Google Calendar links.
A few post back I wrote about how to create urls with Javascript and thanks to that post I was able to make a quick change to Steamrolers page.
This Thursday kicks off our first AMA with Maurice Cherry at 6pm. Our designer added a cool trick to the page which creates a Google Cal event for you from the provided link. I wasn't aware you could do that until now, but it makes sense and seems to be powered by Javascript in the background.
All that is needed is a generated link, which can do easily with some provided sights or you can just create a event on your account and copy the link to the url in your browser and use that link in the href or erb link.

I discovered all this when I went to test the functionality and saw that the generated date was off. Turns out the date code in the url just needed to be updated to what I believe to a UTC translation and voila it all works just dandy.
So if you have any scheduling needs or events to share, now you know how.
This Thursday kicks off our first AMA with Maurice Cherry at 6pm. Our designer added a cool trick to the page which creates a Google Cal event for you from the provided link. I wasn't aware you could do that until now, but it makes sense and seems to be powered by Javascript in the background.
All that is needed is a generated link, which can do easily with some provided sights or you can just create a event on your account and copy the link to the url in your browser and use that link in the href or erb link.

I discovered all this when I went to test the functionality and saw that the generated date was off. Turns out the date code in the url just needed to be updated to what I believe to a UTC translation and voila it all works just dandy.
So if you have any scheduling needs or events to share, now you know how.
Monday, January 26, 2015
Saying goodbye to my biggest cheerleader
10 days ago I received an unexpected phone call from my brother letting me know my mother had past away. My entire world completely stopped while I took time to grieve.
I will miss you mom, thanks for all you have done.
My mother was the hardest working woman I ever knew and I am very grateful for what she has done for me and my brothers. Despite being a single mother, I was able to not only grow up in a decent neighborhood and attend great schools; I have also been given a chance to follow my dreams.
When I began my programming journey, my mother was one of the few I told of my decision to go down this path and encouraged me everyday. She read my blog post and even retweeted my tweets even thought none of it made sense to her.
In support of mothers who are also going down the same journey as myself, into programming, I have given a donation to MotherCoders in her honor.
I will miss you mom, thanks for all you have done.
Thursday, January 15, 2015
An opportunity for friends to help friends
About a month ago I was approach by someone to gauge my interest in a staring a community. This community was to be one that represent the underrepresented individuals in the Tech Sector.
When I first began learning to program I dove head first into tutorials and code samples, I did not really take anytime to look around and didn't realize the proportions of Women and Minorities in tech were extremely. I didn't know as I trail blazed into a career, that I would be on of the few minorities working in my new position.
It is very easy for companies, like Y Combinator to look back and say the reason for this is because women and minorities are not interested in Web Development or Design, and based on the talent pool applying for these jobs is proportionate to the culture make up of who is currently working in the field. Based on their article their outreach efforts will be strengthen, but I am not sure that is enough. What if there more communities like BlackGirlsCode and RailsBridge to source this talent from?
The term friends want to hire their friends comes up a lot and I find no problem with that statement or practice, because I think that this community has the potential the individuals who are hiring and recommending tech jobs to their friends to now make even more friends.
I am proud to announced that I have joined a community of SteamRolers prepared to changed the talent and support each other in their desire to shake up the cultural make up.
If you are at all interested in this, please check out our new site where the conversation has already started. Steamrolers.com
Tuesday, January 13, 2015
Chron job in node
After my recent node battle, I knew the war was not over. I still needed to set up my node script to run in the background. I know with Javascript be an event based I should be able to create a chron job for checking when ever a new signup on the form happens, I should be able to send an invite.
I first started with the forever npm package but similarly with my original requirements for running the unstable version of node, I was unable to use that package, as it is not updated for that.
I then found a StackOverflow question on running the code in an interval. As I thought, this was pretty easy. I am impressed or frustrated with node at the same time, mainly because its not Ruby. In the same vain is not too bad and I can see myself using more in the future for small scripts as the community includes some of the smartest programmers out there and can only increase my experience knowing yet another server side language.
My Code:
I first started with the forever npm package but similarly with my original requirements for running the unstable version of node, I was unable to use that package, as it is not updated for that.
I then found a StackOverflow question on running the code in an interval. As I thought, this was pretty easy. I am impressed or frustrated with node at the same time, mainly because its not Ruby. In the same vain is not too bad and I can see myself using more in the future for small scripts as the community includes some of the smartest programmers out there and can only increase my experience knowing yet another server side language.
My Code:
Subscribe to:
Posts (Atom)








