This post is going to show you how to create a “sticky footer” in Rails with Zurb’s Foundation grid system.
Zurb’s Foundation is a great way to quickly put a front end on your Rails project. One of the features I really enjoy using is their icon font pack. One thing you will quickly realize, however, is they can be tricky to load into your asset pipeline. There are a few threads floating around the web on how to do this, as well this gem, but I am going show you a simple way to set them up.
Geocoder is an awesome gem for manipulating geographic data. I needed a way to search for users by zip code in a recent project, so far it’s been a great solution.
The following is my take on a classic stacks and queues problem.
A queue is like a line at the Apple store. It’s “first in, first out” (FIFO), which means that the item that was put in the queue longest ago is the first item that comes out. “First come, first served.”
Queues have two main methods:
enqueue() : adds an item to the “back” of the line.
dequeue() : removes and returns the next item, or “front” of the line.
A stack is like a stack of records. It’s “last in, first out” (LIFO), which means that the item that was put in the stack most recently is the first item that comes out.
Stacks have two main methods:
push() : adds an item to the “top” of the stack, pushing everything else
pop() : removes and returns the top item, moving the next item to the
Yesterday at Flatiron I had a mock technical interview and was asked to solve a classic Project Euler Collatz problem. Just in case you are not familar with Collatz, here is the set up for the problem.
The following iterative sequence is defined for the set of positive integers:
Given a number n in the Collatz sequence, if n is even, the next number in the sequence is n/2 if n is odd, the next number in the sequence is 3n + 1
Applying the rule above with the starting number 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1. It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms.
Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.
Which starting number, under one million, produces the longest chain?
What is recursion? Wikipedia says “Recursion is the process of repeating items in a self-similar way. For instance, when the surfaces of two mirrors are exactly parallel with each other, the nested images that occur are a form of infinite recursion.”
What is a Fibonacci sequence? In mathematics, the Fibonacci sequence are the numbers in the following integer sequence: 1,1,2,3,5,8,13…and so on. If you want to get the next number in the sequence, you add the two previous numbers before it.
The Fibonacci sequence and recursion are widely discussed in computer science. The goal of this post is not to explain them in their entirety, but to hopefully add clarity to the array of blog posts and writings that already exist.
For me, the hardest thing about solving this problem recursively is it’s difficult to visualize what is happening when you call a method inside itself, over and over. So, the first thing I did was Google. I really wanted to find some type of visual representation of what is happening. I came across this post by Natasha The Robot. If you scroll down you will see a hand drawing explaining the recursive pattern, although it’s hard to read. So I figured I would try to recreate it to bring a little more clarity, which is what you see below.
This post describes the process we used to have our shopping cart and nav bar update in real time as a user adds products.
After a few days of deliberation, I finally have my Disqus comments loading properly. There are a number of tutorials and blog posts on this topic already, not to mention the help section at Disqus, but for those still struggling, this may be your solution.