littleblimp

Direct uploads to S3 with Rails, Paperclip, and s3_direct_upload

littleblimp:

Update May 11, 2014.

An example app is now available on GitHub.

Update Oct 14, 2013.

In keeping with my practice of only passing primitives to DelayedJob to mitigate serialization errors, I made transfer_and_cleanup a static method that accepts a Document ID, rather than an instance method on Document. The new code has been inserted below.

Inaugural post!

I’ve been in the dev game for about 15 years, and for whatever reason I always seem to end up needing the ability to handle user-generated content, i.e. uploads. Back in the day, I used attachment_fu, then transitioned to Paperclip and have stuck with it ever since. Other than a few sketchy point releases, Paperclip has progressed remarkably well and is a solid, reliable solution for handling uploads.

The Paperclip S3 workflow generally looks like this:

  1. User uploads file via a standard multipart form or a snazzified Javascript uplaoder
  2. Server saves the file to a tmp directory and processes it if necessary
  3. File is transferred to S3 and deleted out of tmp

Makes sense, right?

Except for the timeouts that occur when your users have crap connections, or if dealing with very large files. Then there are the platform considerations: Heroku has an explicit 30 second http timeout, and while Engine Yard is as configurable as you want it to be, I have personally seen unresolvable issues with this workflow when uploading files in the hundreds of megabytes.

Not to mention you’re making your users wait for two uploads to complete. Again, with larger files, this ends up being pretty gross.

So what’s the answer?

Upload files directly to S3, skipping the middleman and all the associated hassles. Easy right? There are many articles out there that detail how to do just this, but they generally stop short of detailing the full upload lifecycle.

For my most recent project, I was already using Paperclip for user avatars, which are small enough to not have to worry about custom workflows, and I wanted to continue using Paperclip for file uploads in order to leverage its attachment handling syntax and callbacks. I’ve seen many folks asking about this, so I thought I’d document my process for the greater good.

Let’s get started!

Read More

vicemag
vicemag:

David Shapiro Isn’t Much Use to Anyone
David Shapiro and his Tumblr Pitchfork Reviews Reviews once felt “big on the internet.” Roughly five years ago, Shapiro—then fresh out of college with a shitty job and some self-esteem issues—started writing meta-reviews of the music reviews published on Pitchfork each morning.  As he commuted to a conservative clerical gig, he’d frantically type out ranting but sharp essays on his Blackberry memo pad (sans-capitalizations and with few paragraph breaks), deconstructing the music critics’ arguments and logic, and even commending certain reviews a “Best New Review” tag—a play on Pitchfork’s “Best New Music” symbol of indie gold status. From his office bathroom, he’d often write colloquial personal essays in the afternoon about his relationship with music, which are the only remaining fossils of his site today.
The website got very popular, earning Shapiro over 100,000 followers, writing gigs at The Wall Street Journal, Interview Magazine, and The New Yorker, as well as a profile of his Tumblr in The New York Times. Shortly after he stopped posting on Pitchfork Reviews Reviews, he wrote a screenplay and a novel, both which sold and made it out of production limbo. Despite the success, Shapiro has sworn off writing (save the occasional New Yorker piece), and has since finished most of law school and now works at a white-collar firm in Manhattan. 
His new book, You’re Not Much Use To Anyone, which comes out later this month, is a semi-autobiographical account of Shapiro’s life right out of college. It details the creation of Pitchfork Reviews Reviews and what was going on in his life at a time when he was especially insecure and looking for a form of authority and influence. 
The book’s main character, David, is both anxious and hyper-analytical—fanatical with trifling metrics of success like how many Internet followers he has, or ways his life doesn’t compare to the lives of Pitchfork writers he both idealizes and envies. So even though his Tumblr is just a Tumblr, he feels validated and important when people he was once infatuated with start paying attention to his thoughts and ideas. 
On a surface level, You’re Not Much Use To Anyone, sounds nominal: a physical book about a Tumblr about a music reviews website. But the story is a punchy and sometimes poignant read for any young person trying to figure out how he can become significant or simply noticeable to the people he/she admires. Over the course of a boozy, four-hour interview, we talked about his book being “almost desperate” to get you to finish it, feeling guilty about writing a semi-factual story about friends who didn’t sign up for being characters, and on his relationship with Pitchfork today.

VICE: The inspiration for your Tumblr and writing came from an unlikely source, but can you tell me about the actual inspiration for this book? David Shapiro: I was seeing this girl who was working on a novel and she wouldn’t tell me anything about it. I felt a little resentful that she wouldn’t share it. Later, she broke up with me. And I thought, what better way to get back at her then to write a book myself? It was months after I stopped posting on Pitchfork Reviews Reviews. I refilled my prescription for anti-anxiety medication prescription and wrote a draft in a week.
This must have been insane to pitch to a publisher. It’s a physical book about a meta-Tumblr. How would you describe it to someone with zero context?[Laughs] I still don’t even know how to describe it. I don’t know how to talk about it. I don’t have an elevator pitch. It’s a book about a blog about a popular music reviews website—after a certain point of shopping it around to publishers, I realized it was better to stay quiet during meetings and let my agent talk. 
To me, I mean, if you read the book, in many ways, Pitchfork is not the focus.Definitely. You could say Pitchfork is incidental. In another time, it would have been… I don’t know, like a car a magazine? It could have been written about any fountain of authority.
That’s what I found really interesting. In a lot of ways, your book details the rise of social media as a platform for anyone to assert their opinion and influence.Yeah, or throw rocks at the throne.
Read the whole interview

vicemag:

David Shapiro Isn’t Much Use to Anyone

David Shapiro and his Tumblr Pitchfork Reviews Reviews once felt “big on the internet.” Roughly five years ago, Shapiro—then fresh out of college with a shitty job and some self-esteem issues—started writing meta-reviews of the music reviews published on Pitchfork each morning.  As he commuted to a conservative clerical gig, he’d frantically type out ranting but sharp essays on his Blackberry memo pad (sans-capitalizations and with few paragraph breaks), deconstructing the music critics’ arguments and logic, and even commending certain reviews a “Best New Review” tag—a play on Pitchfork’s “Best New Music” symbol of indie gold status. From his office bathroom, he’d often write colloquial personal essays in the afternoon about his relationship with music, which are the only remaining fossils of his site today.

The website got very popular, earning Shapiro over 100,000 followers, writing gigs at The Wall Street JournalInterview Magazine, and The New Yorkeras well as a profile of his Tumblr in The New York Times. Shortly after he stopped posting on Pitchfork Reviews Reviews, he wrote a screenplay and a novel, both which sold and made it out of production limbo. Despite the success, Shapiro has sworn off writing (save the occasional New Yorker piece), and has since finished most of law school and now works at a white-collar firm in Manhattan. 

His new book, You’re Not Much Use To Anyone, which comes out later this month, is a semi-autobiographical account of Shapiro’s life right out of college. It details the creation of Pitchfork Reviews Reviews and what was going on in his life at a time when he was especially insecure and looking for a form of authority and influence. 

The book’s main character, David, is both anxious and hyper-analytical—fanatical with trifling metrics of success like how many Internet followers he has, or ways his life doesn’t compare to the lives of Pitchfork writers he both idealizes and envies. So even though his Tumblr is just a Tumblr, he feels validated and important when people he was once infatuated with start paying attention to his thoughts and ideas. 

On a surface level, You’re Not Much Use To Anyone, sounds nominal: a physical book about a Tumblr about a music reviews website. But the story is a punchy and sometimes poignant read for any young person trying to figure out how he can become significant or simply noticeable to the people he/she admires. Over the course of a boozy, four-hour interview, we talked about his book being “almost desperate” to get you to finish it, feeling guilty about writing a semi-factual story about friends who didn’t sign up for being characters, and on his relationship with Pitchfork today.

VICE: The inspiration for your Tumblr and writing came from an unlikely source, but can you tell me about the actual inspiration for this book? 
David Shapiro: I was seeing this girl who was working on a novel and she wouldn’t tell me anything about it. I felt a little resentful that she wouldn’t share it. Later, she broke up with me. And I thought, what better way to get back at her then to write a book myself? It was months after I stopped posting on Pitchfork Reviews Reviews. I refilled my prescription for anti-anxiety medication prescription and wrote a draft in a week.

This must have been insane to pitch to a publisher. It’s a physical book about a meta-Tumblr. How would you describe it to someone with zero context?
[Laughs] I still don’t even know how to describe it. I don’t know how to talk about it. I don’t have an elevator pitch. It’s a book about a blog about a popular music reviews website—after a certain point of shopping it around to publishers, I realized it was better to stay quiet during meetings and let my agent talk. 

To me, I mean, if you read the book, in many ways, Pitchfork is not the focus.
Definitely. You could say Pitchfork is incidental. In another time, it would have been… I don’t know, like a car a magazine? It could have been written about any fountain of authority.

That’s what I found really interesting. In a lot of ways, your book details the rise of social media as a platform for anyone to assert their opinion and influence.
Yeah, or throw rocks at the throne.

Read the whole interview

villenoire

africaisdonesuffering:

Women in Africa and the Diaspora: “The Art of Hair”

J.D. Okhai Ojeikere (1930-2014) a Nigerian photographer, documented the captivating hairstyles of young Nigerian women in the late 1960s. His Hairstyle Series consists of over a thousand pictures of fashionable African inspired hairstyles and is the largest of his archive to date. Ojeikere passed away at the age of 83 on the afternoon of February 2nd these pictures, there is no doubt that many of the hairstyles we now wear were inspired by African women. Here are a few of my favorites from the series.

-Bilphena Yahwon