By andyv

excerpt

If you’ve ever wanted to implement a search function in your Ruby on Rails application, you might want to read up on excerpt. Built into ActionView, this helper function lets you extract an excerpt from text that matches a phrase.

This can allow you to show context along with the search results to a user, which is definitely better than just getting the page title.

excerpt(text, phrase, options = {})

excerpt('This is an example', 'an', radius:5)
# => ...s is an exam...

Through use of the provided options, you can control how much is seen on either side of the match.

# break on whitespace between words.
separator: ‘ ‘

# return 8 items on either side of the phrase
radius: 8

Let’s take a look at a more complex example to see how it might be helpful to use for a search results page.

excerpt('Today we had a very beautiful sunrise', 'very', separator: ' ', radius: 2
# => ...had a very beautiful sunrise

As you would expect, the excerpt grabbed the 2 words before and after the matched phrase. Since sunrise is the last word, you don’t see the ellipsis at the end. This gives you the context to know if that result is the one you are really after.

Hopefully you can use this to provide better context for your users.

For full documentation, see the docs.

SPN: No more homework or projects, it’s time to find where we fit

The last two weeks have been a lot of work. I’m not talking about project work, which can actually be a lot of fun. I’m talking about mock interviews, resume writing, portfolio building and documentation writing work.

Omaha Code School has done a lot for us over the last 12 weeks. They’ve taught us, helped us overcome difficult problems and provided mentors for us to learn from. But at no point have they been more helpful than the last two weeks. Lately we have been working on getting all our work ready to show to potential employers.

OCS found mentor after mentor willing to come review our resumes, give mock interviews and give us their prospective about what makes candidates stick out. It’s an eye-opening experience that preps you for the microscope that is the hiring process.

Two weeks ago, we took a much needed break to give a presentation for 1 Million Cups, a local entrepreneurship meetup. They asked us to give a couple of quick presentations about our group projects.

At first it was extremely intimidating. Roughly 50 people we had not met before in a giant lecture hall on UNO’s campus. As we got up to speak, I just put all that behind me and started to go through what we had practiced.

We talked about our client, SMAC! (Sock Monkeys Against Cancer), and how they needed a system to find angels for those in need. Everyone seemed to like what we had put together and were impressed at how far we had come in the first eleven weeks of class. It was a welcome dose of encouragement that we are starting to know what we’re talking about and can contribute to this community.

This was all building toward graduation night. A ton of people showed up to congratulate us on all the work wehave put in and to see what we have been up to over the past twelve weeks. We had a short ceremony, with an inspiring commencement speech from Megan Hunt. We received our awesome wooden diplomas, and had some time to show off our projects to family and friends who came down to take a look. But this night was mainly a celebration. We ate, drank, took advantage of the photo booth, danced and ate some more. It was a great night that left me completely exhausted.

Now it’s been two days since we graduated from Omaha Code School. The pressure is off. No more homework. No more projects.

So now what? Where do we go from here? What is the next thing on this amazing journey we have all been on?

For most of us, the next step is a job fair Omaha Code School is putting together for us. They have attracted the attention from the who’s who in local development businesses. Graduates will be able to talk to each business and start to understand what makes them tick. Nothing is guaranteed, but we will see firsthand what companies are looking for and how we might fit into that void.

Lastly, I have enjoyed recapping my code school adventure for Silicon Prairie News over the last three months. I cannot thank Jordan Pascale and the team enough for giving me this opportunity to get the word out about what we are doing. It seems like every event I attend has someone coming up to me who has read a post or two and it has peaked their curiosity. I don’t think we would have garnered the attention we have if it was not for SPN and their willingness to cover this school. I can never truly express my thanks for all they have done. Thank you.

New Website and Graduation Details

andyv.me just launched! It’s a new portfolio website where I can show off some of the projects I have worked on, and get the word out about some of the skills we have learned over the past 12 weeks. I will also continue to blog there after Omaha Code School is over. I would love to get a little feedback about what I have put together.

Friday is graduation day. I can hardly believe it’s already here. We have transitioned from our intense learning style to a more relaxed week working on getting our resume put together. We had a full week of guest speakers come in and walk us through the interview process and give mock interviews. It’s been a while since I’ve gone through this, so I really appreciate the practice.

Everyone is invited to our graduation party! This Friday, May 16th, at 6pm we will be having a graduation celebration at Omaha Code School. Everyone is invited. There will be plenty of food and drink to go around. We will also be having a short presentation. While your mingling, ask us if you can see our other projects, we will be happy to give you a quick look.

SPN: A Client can be a Wonderful Thing

Having a client is a powerful thing. We started on a group project last week for SMAC! Sock Monkeys Against Cancer, a local organization that makes sock monkeys for cancer patients. Their founder, Jen Windrum, went through a devastating lung cancer case with her mother, who sadly passed away last year. Her mother lived 2,000 miles away, and she wanted to give her mother something she could keep with her during appointments and procedures when she couldn’t attend.

Jen often gets requests from a patients who would like a SMAC! monkey, but can’t afford it due to their ongoing treatments. When these cases come up, Jen relies on her existing social media channels to find someone willing to cover the cost. She calls them “Angels.”

This process works, but is very manual and time intensive. Many patients don’t realize they can request a SMAC! monkey. Once they do find a match, Jen must communicate directly with both sides to make sure the right information gets exchanged. Even though these are some of the more rewarding situations she deals with, it is a lot of work for her.

Seven of us were tasked with taking some of the friction out of the process. We needed to create a new website for the SMAC! Monkey Angel Program. The site needed to allow people to request a SMAC! monkey, and display their request to people who might be willing to cover the cost for them. We divided ourselves up into specific roles for this project. Johnathon, Todd, Matt and Lochlan were our back-end developers. Britt and Yofred were front-end specialists. I was the technical lead. This was the first time we had a specific focus and this many people working on a single project.

Luckily, we had a great client to work with in Jen. She was very excited to see what we came up with and gave us quite a bit of flexibility with how the site would look. I think we came up with a clean, informative site that really does take the friction out of the equation. With the new site (right), a person can request a SMAC! monkey for either themselves or on behalf of someone they know. People who see their request can share the need using the Facebook or Twitter share buttons right on the page.

If you want to get the first look at what we’ve built, I would like to invite you to come to 1 Million Cups this Wednesday at 9 a.m. 1MC meets in Mammel Hall on UNO’s campus and they have allowed Omaha Code School students to present our projects this week. Our team will be demoing our SMAC! Angels site. Another group of students will be showing off their recent redesign of the omawho.com website. I think both turned out pretty well, so come take a look and give us your feedback.

We are less then two weeks away from graduation. It has been a whirlwind experience. Going back and looking at the first couple of sites we created, it’s clear we have learned a lot and come a long way.

Here are a couple of events open to the public next week:

Allies Workshop

Monday, May 12, 6–8 p.m.

The Allies Workshop was designed by the Ada Initiative “to support women in their workplaces and communities.” Andrew and Zedeka will be conducting their own variation of the workshop. They will discuss allyship as it relates to gender, but also explore race, class, color, ability, identity and orientation. There is a cost to this course, so check out the Facebook page for more information.

Graduation Open House / Demo Night

Friday, May 16, 4:30–7:30 p.m.

This event will take place immediately after we graduate from Omaha Code School. Students will be on hand to show off some of their group or individual projects they have worked on in class. This will be the best opportunity to see how far we have come in 12 weeks.