Skip to content

Instantly share code, notes, and snippets.

View justinthiele's full-sized avatar

Justin Thiele justinthiele

View GitHub Profile
@rigelstpierre
rigelstpierre / spotify.rb
Created December 7, 2014 19:18
Spotify Auth
def spotify
self.validate_spotify_auth_token if self.spotify_auth_token.present?
config = {
:access_token => self.spotify_auth_token, # initialize the client with an access token to perform authenticated calls
:raise_errors => true, # choose between returning false or raising a proper exception when API calls fails
# Connection properties
:retries => 0, # automatically retry a certain number of times before returning
:read_timeout => 10, # set longer read_timeout, default is 10 seconds
:write_timeout => 10, # set longer write_timeout, default is 10 seconds
@justinthiele
justinthiele / Readme.md
Created September 11, 2011 04:43
Retaining form data through a login process and resubmitting the form [Rails & Devise]

This is a feature I struggled with for quite awhile, so I thought I'd share my solution. The code is actually pretty simple once I got it figured out. Hopefully it will save somebody else some headaches.

So here's what we're doing

To create an easy on-boarding process, I've put a New List form on the front page of Favsi.com. However, creating a list requires the user to be authenticated, so I needed to create a way to retain the user's New List form data through the authentication/registration process, and then post it. Here's a screenshot of the front page: Favsi Front Page Form

The flow would go like this

  1. User goes to the front page.
  2. User fills out the New List form and presses the Create List button.