Skip to content

Instantly share code, notes, and snippets.

@daraosn
Created July 31, 2012 16:15
Show Gist options
  • Save daraosn/3218195 to your computer and use it in GitHub Desktop.
Save daraosn/3218195 to your computer and use it in GitHub Desktop.
Thunderclap bug @ Babelverse project page
// BUGGY:
project_page.campaign_id = 191;
project_page.twitter_backed = ; // HERE IN RUBY: project_page.twitter_backed = <%=twitter_backed%>;
// Uncaught SyntaxError: Unexpected token ;
project_page.facebook_backed = ; // HERE IN RUBY: project_page.facebook_backed = <%=facebook_backed%>;
project_page.total_backers = 18;
project_page.total_reach = 13482;
project_page.time_left = 0;
project_page.goal = 500;
project_page.progress = 3;
project_page.time_progress = 47.36169029044353;
project_page.init();
// FIX #1: Check nil values (good practice)
project_page.twitter_backed = <%=twitter_backed.blank? ? 0 : twitter_backed%>;
project_page.facebook_backed = <%=facebook_backed.blank? ? 0 : facebook_backed%>;
// FIX #2: Treat numbers as strings (ugly method, but works)
project_page.twitter_backed = '<%=twitter_backed%>';
project_page.facebook_backed = '<%=facebook_backed%>';
@daraosn
Copy link
Author

daraosn commented Jul 31, 2012

hey codegiant, I like your startup thunderclap, keep rocking!

I found this issue on my iPhone using Chrome and on my Macbook using Chrome too. This problem occurs both when logged in or not.

Hope you can kill the bug :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment