Last active
December 16, 2015 20:38
-
-
Save GantMan/5493336 to your computer and use it in GitHub Desktop.
code to show async grab using Bubblewrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleCode | |
attr_accessor :lines | |
DOMAIN = "www.yourdomain.com" | |
def next_line | |
if @lines.blank? | |
#refurnish | |
@lines = App::Persistence['quips'].dup | |
@lines.shuffle! | |
end | |
@lines.pop | |
end | |
def remote_update | |
p "checking if update is needed" | |
BW::HTTP.get("http://#{DOMAIN}/api.json") do |response| | |
if response.ok? | |
json = BW::JSON.parse(response.body.to_str) | |
#Check if counts differ to | |
if json['size'] != @lines.size | |
# go get em | |
self.perform_update | |
end | |
else | |
p "Check Failed: #{response.error_message}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UGH! WTF INDENTATION!?