### Dr. Strangemath, or: How I Learned to Stop Worrying and Love the Fibonacci Sequence

Okay, so I have not yet learned to stop worrying (pretty sure that’s just a lifetime commitment), but anyone who knows me knows that I LOVE the Fibonacci sequence! One of my favorite pieces of jewelry is this Fibonacci spiral necklace:

Above: Fibonacci necklace by Agate and Elm on Etsy

I always know that I’ve met a kindred spirit/fellow math nerd when someone comments on it, and I wear it every chance I get (or at least, when it goes with my outfit). So why do I love the Fibonacci sequence so much?

First of all, some of you may be wondering - what is the Fibonacci sequence? And how does it turn into that cool spiral? Quite simply, the Fibonacci sequence starts with 0 and 1; every number that follows in the sequence is the sum of the two numbers before it, like so:

0,1,1,2,3,5,8,13…. etc.

If you were to stack squares made up of these numbers on top of and next to each other to form a rectangle, it would look like this:

Source

If you connect those corners with a curved line, you get this beautiful spiral:

Source

(Okay, so those spirals don’t totally match, and one is slightly incorrect, but you get the idea)

The thing that really amazes me about the Fibonacci sequence, however, is not the manner in which it can be used to create a cool looking spiral, but the frequency with which one can see this spiral in action. Look around you, it’s everywhere! Check out any nautilus shell, for example:

Source

Or even look as far out as the depths of space towards this spiral galaxy (which, according to the source, make up 77% of our universe’s observed galaxies):

Source

BUT WAIT, THERE’S MORE!

Ever heard of the Golden Ratio? If you went to art school, as I did, then you should already know all about it. However, most people did not go to art school, so I’ll give you a quick primer.

If the ratio of two numbers is the same as the ratio of their sum to the larger of the two numbers, then they are in the golden ratio.

Source

This ratio has been used in art for centuries! Leonardo da Vinci believed that the proportions of human bodies were in the golden ratio. Other artists, such as Salvador Dali and Piet Mondrian, were known to utilize the golden ratio in their work. Salvador Dali even modeled the shape of his famous painting, the Sacrament of the Last Supper, in dimensions that conform to the golden ratio.

Source

But what does the Golden Ratio have to do with the Fibonacci Sequence?

Great question!

If you divide any number in the Fibonacci sequence by the number immediately preceding it in the sequence, the result is pretty damn close to the Golden Ratio.

You can see pretty plainly that this geometric interpretation of the Golden Ratio looks a LOT like some of the shapes created by the Fibonacci Spiral:

Source

There is just SO MUCH to love about the Fibonacci sequence; I’ve just barely scratched the surface here! If you’re interested, a quick Google search will yield a tremendous amount of information on the subject. I couldn’t possibly recommend one resource over another because there is just so much out there!

Isn’t math so cool?

Source

### New To Tech? Amanda Peyton of Grand St and Etsy Shares Some Advice on Landing Your First Coding Job

Just started coding and thinking of working in tech? Amanda Peyton, founder of gadget marketplace Grand St and now a part of Etsy’s team, has some advice for brand new engineers looking to land their first job. She stopped by Flatiron School to talk through questions she always gets about how to start working in tech. Here’s what we learned:

### Big company for structure, startup for speed

If you’re new to tech, and thinking about where to start looking for jobs, look to yourself first. What you want out of your next job should guide your decision—are you the artist who wants to construct something perfect or push features out of the door?

For structure and mentorship: try a bigger company. There will at least be other, more senior people to answer your questions and review your code. There’s also a lot more emphasis on building for the long-term and avoiding technical debt—which will allow you the time to spend learning more about their codebase and perfecting your own work.

Small startups, on the other hand, are more concerned with shipping fast and often, even if it involves duct tape and Band-Aids. If you choose to work at one, you might not have a mentor, but your daily routine will probably be more varied than it would be working on a small feature within a vast and established codebase. If you get into a startup early enough, there will be tons of hard problems to work through independently, and you’ll probably do a little of everything at some point.

### Culture fit is really, really important.

Companies don’t expect junior engineers to know everything. They know they’re going to have to invest some time and resources in helping junior talent get better at their jobs. This means a couple things: (1) people interviewing for junior roles don’t have to be experts, but (2) they do have to be a good culture fit.

Culture fit is huge for new engineers, and companies will usually dedicate a lot of interviewing to it. Don’t get overwhelmed when scheduled to meet with 10 people on an interview—this usually means they’re excited about an applicant—but always remember that culture fit goes both ways. Applicants should also be assessing whether or not a company is a good cultural fit for them. It is super important for them to make sure they are going to love working with their potential employers.

### Knowing how to learn new skills is even better than having in-demand ones.

It’s not as important as it seems to pick a programming skill based on market demand. Today, in September 2014, demand for developers of every variety is crazy. If you’re really good at something specific like Backbone.js, you can probably find a job doing just that.

But every so often a new technology comes out, and the slate is completely wiped clean. When something changes, everyone, regardless of how much experience they have, is forced to learn something new. New technologies are total equalizers. Perhaps the most valuable, in-demand skill you can have is to be flexible and excited about learning whatever’s next.

That said, demand for mobile developers is huge—so much so that even having smart opinions is valuable. So if you really want to focus on a skill that everyone needs, consider learning a programming language that you can use to build a mobile app.

### Get out from behind that monitor and go do stuff.

Building a network means getting to know people in some informal way, so you’re not just that person who is coming in to interview. To get to know people, don’t hesitate to send emails or go to Meetups. Companies throw all kinds of events, so don’t be afraid to just show up and introduce yourself in a pressure-free environment.

It could also be worth it to go to conferences. If you pick one and explore, you’ll not only get a feel for the industry that you wouldn’t normally. You’ll also get to meet people. Who knows? Maybe the person you talk to for five minutes at JS Conf will help you get your next job.

### Never miss an opportunity to show attention to detail.

Little details can be really important, and the best way for new engineers to show they care is through doing, not telling. Here’s a good place to start: read a potential workplace’s general or developer blog. Applicants rarely do this, but companies invest a lot of time and thought into their blogs. These can give applicants a sense of a company’s culture and help them show interest outside of an open position.

Not everyone reads cover letters, but new engineers can use projects to demonstrate who they are as people. If you’re showing projects to potential employers, pay attention to detail. Polish them—fix bugs and proofread UI copy. Even without a technical interview, if someone can show craft and effort in their projects, they’re showing they can do the same on the job.

### Don’t wait for the technical interview to share what you can bring to a company

In a non-technical interview, be engaged, ask thoughtful questions, and don’t be ashamed of a lack of experience. Research potential employers before an interview and form informed opinions on their products.

Applicants with less experience are often afraid to say things like “here’s what your company needs…” and “here’s what I can do for you…”—but it’s what a lot of interviewers want to hear. Particularly in smaller companies with fewer than 100 people, talking about a problem and actually proposing a thoughtful solution shows initiative, regardless of how much experience someone has.

Right now, tech is filled with opportunities for new coders. No matter if you have three months or three years of experiences, it’s an incredibly dynamic field. It’s not only changing everything, but every new change in tech has the potential to totally level the playing field and get people at all levels of experience learning something new. Who wouldn’t want to be a part of that?

Huge thanks to Amanda for stopping by our campus. You can also find her on Twitter or check out her blog right here.

### Prettyin’ up code for your blog the easy way, using GitHub Gists!

When I first started writing this blog, I had no idea how to format my code so that it looked decent, so I would just take screenshots of my code in Sublime, or even while it was still in irb. I had read a lot of other code blogs and noticed that other people’s code could be copied and pasted - obviously they were not screenshots! I had to figure this out.

There are many ways to pretty up your code snippets, but my favorite is to simply put my code in a GitHub Gist and copy-paste the code provided all the way on the right where it says “embed,” like so:

Then it looks all nice and pretty on your blog, like so:

If you’re using Tumblr (as I am, currently anyway) you can also just place your raw code between a couple of <pre class=”language-ruby”></pre> tags (obviously switch out “ruby” for the language of your choice if it’s not Ruby). It mostly looks fine, just black and white. However, if the code is wider than your blog it might just continue off the side of your post (unlike the GitHub Gist, which has a built-in scroll bar).

It looks like this:

```class TriangleError < Exception
end

class Triangle
attr_accessor :equilateral, :isosceles, :scalene

def initialize(side1,side2,side3)
@side1 = side1
@side2 = side2
@side3 = side3
end

def kind
if @side1 == 0 || @side2 == 0 || @side3 == 0
raise TriangleError
elsif @side1 <= 0 || @side2 <= 0 || @side3 <= 0
raise TriangleError
elsif (@side1 + @side2) <= @side3
raise TriangleError
elsif (@side2 + @side3) <= @side1
raise TriangleError
elsif (@side1 + @side3) <= @side2
raise TriangleError
elsif @side1 == @side2 && @side2 == @side3
:equilateral
elsif @side1 == @side2 || @side1 == @side3 || @side2 == @side3
:isosceles
else
:scalene
end
end

end
```

Personally, I think the embedded Gist is much more aesthetically pleasing, so that’s my preferred method to post code. But, if you Google around you can find many different methods other than the ones I listed here, so feel free to do a little searching of your own and see what you can find!

Flatiron Students Present! with Liz Baillie and Luke Demarest

Above is a video of my presentation with Luke Demarest on the Ruby Processing Gem from 7/15/2014, which I wrote about in an earlier post. In this presentation, we speak on the origins of the Processing programming language, and some basics on how to use the Ruby Processing Gem to achieve similar results.

This is followed by a few really cool demos, including my favorite that utilizes the Twitter streaming API in tandem with the gem to create an awesome live video made of tweets (watch it to see what I mean)!

If you’re at all interested in the intersection of visual art and programming, I encourage you to check out both Processing and the Ruby Processing Gem

### Hobo Name Generator is LIVE!

Good news - I am now officially a graduate of the Flatiron School class of RUBY-005! Hurray!

Can you pick me out of the crowd?

Now that I have some free time, I can finally update you on the progress of my Hobo Name Generator, which is now live (and has been for several weeks but sssh, don’t tell anybody)! You can view the complete code on my GitHub account, but first I’d like to review some highlights of various technical aspects of the project that caused me some amount of confusion. (If you’d like to read my original blog post on this topic, you can do so right here)

First, I changed the structure of the model altogether. I now only want to add the user’s name to a random hobo-esque adjective, so this is the new/current structure of the model:

Next, in app.rb, I defined the routes, which was the hardest part for me to figure out:

The trickiest part for me was learning about exactly what “get” and “post” meant (this was about a month ago, so don’t worry, I know better now!). I had been looking at the code of a similar project done by a classmate, whose code was almost identical to mine in structure, but only had one “get” and one “post” request. No matter how I arranged my code, even seemingly copying it exactly, I could not get Sinatra to understand this ditty!

Finally, I rearranged my code in a way that made sense to me, and it worked! Three cheers, hurray! I knew it made sense that I would need another get request, and I was right!

It was definitely helpful to look at other people’s code in order to figure out how all the moving parts in Sinatra work together, but in the end, I learned that one person’s code is another person’s Sinatra error page, and it’s best to trust your instincts!

Next Steps

I know my Hobo Name Generator app is super simple, but I’d really like to utilize an AJAX request to have it all on one page (mostly so I can learn more about how AJAX requests work). I’d also like to pretty up the page a bit with some of my own original hobo-themed art, and figure out how I want to integrate the Hobo Name Generator into the Freewheel webcomic site.

### Canyon of Heroes

Or a lesson in Financial District history, from Ruby student (and archivist!) Ashley Blewer, originally posted here.

When walking to and from class every day at the bottom of Manhattan, I’ve noticed plates of text on the ground with a date and name of a famous person. I didn’t realize what these signs were about until I was walking out of the southmost Bowling Green stop and saw the initial plaque on the ground:

After that, everything clicked! They are commemorating every ticker-tape parade held on Broadway, starting with the first to commemorate the dedication of the Statue of Liberty in 1886.

Before I came to the Flatiron School, I was working as a moving image archivist. I primarily worked with collections of newsreels from the 1920s and 1930s. My job was to catalog them and put them online for access. When I realized what the text on the ground stood for, I immediately ALSO realized that I recognized so many of the names because I had seen some of the actual parades happen (on film)! The text that struck me the most while walking up the street was this one:

I’ve definitely watched this footage. I ran to the (digital) archive and sure enough, there it was.

Footage identification can be difficult when you don’t have a lead, but this connection was pretty easy to make. I watched the footage, paying attention to the structures of the buildings, and then pulled up Flatiron School’s address on Google Streetview. Boom! It was a total match!

Here is a screencap of the Amelia Earheart ticker-tape parade superimposed on top of Google streetview.

Pretty cool!

Bonus: The building that the Flatiron School is located in used to be the office building for the White Star Line, which built the RMS Titanic (and many other, sturdier ships). Cool!

### Using the Twitter Streaming API

For my upcoming Flatiron Presents Meetup presentation (which is TONIGHT, eek!), my presentation partner Luke and I went through a number of ideas before settling on the topic of Using the Ruby-Processing Gem. After explaining how the gem works and what it does, we initially wanted to reenact a presentation given by Jason Cale at Ruby Manor in 2009.

During this presentation, he grabbed a number of then-recent tweets that mentioned Ruby Manor and stored them in a text file. He then used the letters almost like pixels, so that the size and color of the letters varied as a function of the light entering the camera, as defined by the code he wrote using the Ruby-Processing gem.

We thought it would be cool to alter the code to use the Twitter Streaming API by entering a relevant search term (such as “Flatiron School” or “soccer”) so that instead of the letters on the screen being static, they would change every time a new tweet with that search term was added.

We were not able to make it so that the onscreen text was streaming, but we were able to write any amount of the most recent tweets on a given topic to a text file, and pull from that. We had an incredibly difficult time figuring out how to write the tweets to a text file, but in the end, this is what worked for us:

```TweetStream.configure do |config|
config.consumer_key       = 'xxxxxxxx'
config.consumer_secret    = 'xxxxxxxxxxx'
config.oauth_token        = 'xxxxx-xxxxx'
config.oauth_token_secret = 'xxxxx'
config.auth_method        = :oauth
end

tweets = []

TweetStream::Client.new.track('bacon') do |tweet|
tweets << tweet.text
File.open('tweets.txt', 'w') {|f| f.write tweets.join("\n")}
client.stop if tweets.size >= 100
end```

So, using the tweets we grabbed with the search term ‘bacon’, we were able to use them sort of like pixels, in video form, like so:

(I know it’s hard to tell what’s going on, but I promise, it’s pretty cool in person, so you should come to the Meetup and see it live)

Using the Twitter Streaming API on its own is not too challenging, but as I discovered over the course of this project, there have been a lot of changes in recent years and most of the examples I found online that were doing what I wanted to do were outdated.

The first step is to sign into https://dev.twitter.com/ with your Twitter account and get your API keys, which you need in order to access the Twitter API. It’s not too hard, they ask you to put in a project name and a link and all that, but you can put in almost anything.

Once you have your API keys, just plop them into your project like so (as you saw in the previous example):

```    require 'tweetstream'

TweetStream.configure do |config|
config.consumer_key       = 'xxxxxxxx'
config.consumer_secret    = 'xxxxxxxxxxx'
config.oauth_token        = 'xxxxx-xxxxx'
config.oauth_token_secret = 'xxxxx'
config.auth_method        = :oauth
end

TweetStream::Client.new.track('soccer') do |status|
puts "#{status.text}"
end
```

So, for example, in this case we are tracking the search term ‘soccer.’ If you run this code in the console, it will display a real-time series of tweets about soccer, as they happen! So neat!

There are tons of cool possibilities! Check out the Twitter Streaming API documentation and try it for yourself!

### Hobo Name Generator

Back in 2010, I was still writing and drawing a webcomic called Freewheel. Freewheel was a fantasy adventure about a young girl who runs away from foster care to find her missing brother, and in the process discovers a secret world of what I called, for lack of a better term, “magical hobos.”

One of my neat little tricks to get people to approach my table at conventions was to offer them a “free hobo name.” This involved having them roll a large, 20-sided die twice and giving me the numbers. I would check the numbers against a list I had under the table and write them up a name tag with their randomly-generated hobo name on it. They would wear the name tag (which conveniently also had my url and the name of my comic on it) around the convention, people would ask them about it, and thus drive others to my table. It was a great little trick, and it worked exceedingly well in driving new readers to my table.

I took a lot of pictures of people with their accompanying hobo names at a convention called Heroes Con in North Carolina back in 2010. Here are some of my favorites:

Maybe I’ve been listening to a little too much Tom Waits, but I thought, why not create a Hobo Name Generator for my comic’s website? I’m not quite far along enough yet in my understanding of Sinatra to use it in any meaningful way, but I figured I could at least start by creating a HoboGenerator class and throw in some of my old favorite “hobo names.”

So far, the HoboGenerator class looks like this:

I wrote a basic HoboGenerator class that takes a user’s name on initialization, so we can use it as part of their hobo name (if we want to). There are three basic methods - hobo_name_neutral (which just adds an adjective to your own name), hobo_name_female (which gives you a random female hobo name), and hobo_name_male (which gives you a random male hobo name). The names are mostly the same as the ones I used to use at conventions.

The idea is that, eventually, the user will be able to choose whether to use their own name to hobo-ify or to choose a random male/female name. In order to generate the names randomly, I stuck them in arrays and called the .sample method on them to choose a random item in the array. Then, I concatenated the two names and assigned them to an instance variable, so I could call the method to have it return the user’s “hobo name.”

So, if I stick a binding.pry in there, and run it, I can play with it and generate some fun hobo names! Eventually I will figure out how to use Sinatra to turn it into an actual web app, but I’m still just starting out with that (and didn’t really have time) so it will have to wait for another day!

I’m partial to “Whiskey Felicity”, myself. As a bonus hobo-related treat, here’s my favorite Tom Waits song, in which he sings at length about being a hobo:

### Orange is the New Hash

During my first two weeks at the Flatiron School, I was inundated with information. I spent so much time coding and learning about code that I actually started to dream about it. One night, I went to bed after watching one of the new episodes of Orange is the New Black, and had an incredibly detailed dream about sorting the fictional Litchfield prison into a system of nested hashes.

I had been having a lot of trouble that week learning how to create and iterate over hashes, so I thought, “why not work on creating that Litchfield hash I dreamed about?” So, here we are.

You can’t have a prison without COs, so let’s start with them. First, I created the Litchfield hash, and then added Mendez as a CO. However, I noticed that when I tried to add O’Neill as an additional CO, Mendez disappeared. What happened?

I realized that the COs key could only point to one thing, so I needed it to point to a single array in which I could store all the COs, otherwise every time I tried to an a new one he or she would override the previous one. We can’t have a prison with just one CO, can we?

Let’s start by assigning an empty array to the COs, so we can fill it up.

Then, we can hire some COs and push them into the array, like so:

There must be a quicker way to do this. When we create the “prisoners” key, can we start right off by assigning it to an array of names, instead of creating an empty array and assigning them one by one? Yes, we can!

Awesome. Now we just need to add some administrative staff, which we can do like so:

Great! Now we have ourselves a prison. But prison is not quite so simple. Unfortunately, sometimes prisoners get thrown in the SHU (solitary confinement). Chapman was just attacked by Pennsatucky with a shiv, and now Chapman’s in the SHU for fighting. Let’s have each of the prisoners’ names point to new hash where we can store their details, such as whether or not they are currently in the SHU.

I had a really hard time figuring out an easy way to turn each prisoner name string into a key pointing to a key/value pair of {:SHU => true} or {:SHU => false}. I spent way more time on trying to figure than out than I probably should have.

Eventually I realized I could just create a separate prisoners hash with each name pointing to an empty hash, stick it inside an array, and use the replace method to replace the old array of strings with an array of hashes!

First, the new hash created from the prisoners list:

Then, stick that hash into a new array, and replace the old array with the new one:

Next we get rid of that pesky array surrounding them so we can more easily manage them as a hash. We can do this by reassigning the first index of the prisoners array (which is the entire hash) to the Litchfield prisoners hash. This gets rid of those ugly brackets:

So when we call “Litchfield,” we now get this:

Now we want to have Chapman’s hash to point to a new hash that describes her current SHU status, like so:

Finally, when we call Litchfield, we get this:

Now, if we wanted to add any more details to anyone’s hash, we know how to do it!