Skip to content

Instantly share code, notes, and snippets.

@GantMan
Last active December 16, 2015 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GantMan/5493336 to your computer and use it in GitHub Desktop.
Save GantMan/5493336 to your computer and use it in GitHub Desktop.
code to show async grab using Bubblewrap
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
@GantMan
Copy link
Author

GantMan commented May 1, 2013

UGH! WTF INDENTATION!?

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