Background Tasks & Rails – A Sidekiq Example

This post involves a little bit of everything–queuing (Sidekiq), JSON, API calls, redis, database manipulation. Enjoy!

The latest feature I am pushing to Dotawithme is listing the players by who is currently online. This is an oft requested feature (with good reason – DOTA players are impatient) but I wasn’t entirely sure what the best way to go about this was.

Of course I couldn’t just hammer Valve’s Steam API or I would quickly hit my daily limit. This means I need to create a background process to run at set intervals and update the database accordingly. There are many different gems to help your Rails app out with this and I settled on Sidekiq (‘Sidekick’) because it’s fast and (supposedly) simple to use.

Continue reading

Tweet Random Quotes with Ruby

I recently started using Buffer with my Twitter account in the hopes that I would be more active by queuing up my tweets in advance.  One of the great things about Buffer is that it offers suggestions on things you might want to post.  Often times they have quotes in their suggestions and since I am a big fan of quotes I decided to write my own tool to just publish quotes.

Continue reading

Use Google Fonts in Rails Apps

I wanted to use a Google Font for a logo and no where else in the site. It took me a fair amount of googling to figure out something that is relatively simple. One of those annoying problems of syntax differences again. Anyways, this is just a quick post with the answer in case anyone else follows in my footsteps.

Continue reading

Resizing the Width of a Text_area (Rails/Bootstrap)

So on one of my personal projects I’m working on I have an input area that is used for blog posts. The default “text_area” in Rails is small. Certainly not a box big enough for your typical blog post. Of course one can resize this manually in one’s browser. However, I’m building this to make some easy enough my Grandma could use.

Continue reading

Fast Way to Use Bootstrap: Part 1

Recently I started learning Ruby on Rails to build a couple projects.  I’ve heard of Bootstrap and heard you can use it quickly to make a site look good.  Since Bootstrap seems to be the popular way to do things I wanted to test it out myself.  Unfortunately, I was immediately lost.  Things were not very clear to me on what exactly I was suppose to do with it.  So here are some of the things I wish I would have learned about Bootstrap straight out the gates.

Continue reading