Skip to content

Instantly share code, notes, and snippets.

View scottwater's full-sized avatar

Scott Watermasysk scottwater

View GitHub Profile
@scottwater
scottwater / kickoff.json
Last active August 6, 2019 17:57
KickoffLabs API Demo Response
{
"avatar": "https://d1ts43dypk8bqh.cloudfront.net/v1/avatars/310c4ac2-7026-4700-afde-496b1d217b03",
"counter": 252,
"contest_score": 300,
"contest_score_rank": 19588,
"custom_fields": {},
"email": "[email protected]",
"family_name": "Watermasysk",
"given_name": "Scott",
"id": 56999,
@scottwater
scottwater / api.rb
Created November 3, 2011 17:33
Thoughts on how to properly handle exceptions in a web service request?
require 'httparty'
require 'crack'
class KickoffLabsAPI
include HTTParty
base_uri 'http://api.kickofflabs.com'
def self.subscribe(page_id, args={})
response = post("/v1/#{page_id}/subscribe", :body => args)
curl -d '[email protected]' http://api.kickofflabs.com/v1/1905/subscribe
curl -G -d "[email protected]" http://api.kickofflabs.com/v1/1905/info
@scottwater
scottwater / full_constraint.rb
Created December 2, 2011 21:00
Possible Authenticated Constraint for Sorcery
# SCOPE GETS CROSSED - DO NOT USE AS IS!
class AuthenticatedConstraint
extend Sorcery::Controller::InstanceMethods
def self.matches?(request)
Sorcery::Controller::InstanceMethods.send(:define_method, :session, proc{request.session})
Sorcery::Controller::InstanceMethods.send(:define_method, :request, proc{request})
logged_in?
end
end
@scottwater
scottwater / gist:1531929
Created December 29, 2011 04:37
Quick Notes on BootStrap vs. Foundation
- Bootstrap feels more opinionated and ready launch (prototypes)
- Bootstrap is being used everywhere. This is great for bug fixes, plugins, etc...
- Bootstraps popularity sucks because I suspect 1 in 5 new sites will look identical next year.
- Foundation uses sass. Bootstrap (conversions/ports) favor scss. I prefer scss.
- I also like how you can override BootStrap variables without changing the actual source
- Foundation has responsive support today.
- Foundation has some interesting mobile style options
- Bootstrap appears poised for a V2 with lots of breaking changes.
@scottwater
scottwater / gist:1537789
Created December 30, 2011 04:11
wikipedia
$(document).ready(function(){
$('#siteNotice').hide();
});
@scottwater
scottwater / topsy.json
Created January 11, 2012 19:08
topsy example (bug?)
{"request":{"parameters":{"window":"h3","q":"kickofflabs"}
,"response_type":"json","resource":"search","url":"http://otter.topsy.com/search.json?q=kickofflabs&window=h3"}
,"response":{"window":"h3","page":1,"total":4,"perpage":10,"last_offset":4,"hidden":0,"list":[{"trackback_permalink":"","trackback_author_url":"http://twitter.com/russellbuckley","content":"MWC Unofficial Fringe Festival 2012 - Coming Soon! http://t.co/aR2LwZon","trackback_date":1326306392,"topsy_author_img":"http://a2.twimg.com/profile_images/1335736386/Twitter_normal.jpg","hits":1,"topsy_trackback_url":"http://topsy.com/trackback?url=http%3A%2F%2Fmobile-world-congress-fringe-festival.kickofflabs.com%2F%3Fs%3D3G79&utm_source=otter","firstpost_date":1326306392,"url":"http://mobile-world-congress-fringe-festival.kickofflabs.com/?s=3G79","trackback_author_nick":"russellbuckley","highlight":"MWC Unofficial Fringe Festival 2012 - Coming Soon! http://t.co/aR2LwZon ","topsy_author_url":"http://topsy.com/twitter/russellbuckley?utm_source=otter"
@scottwater
scottwater / api.coffee
Created January 18, 2012 02:21
Sample Coffee
jQuery ->
$("form").submit (e) ->
e.preventDefault()
email = $("#email").val()
return if email.length == 0
$.ajax
url: "https://api.kickofflabs.com/v1/1905/subscribe",
data: "email=#{email}",
dataType: 'jsonp',
jsonp: 'jsonp',
jQuery ->
$("form").submit (e) ->
e.preventDefault()
email = $("#email").val()
return if email.length == 0
$.ajax
url: "https://api.kickofflabs.com/v1/1905/subscribe",
data: "email=#{email}",
dataType: 'jsonp',
jsonp: 'jsonp',
@scottwater
scottwater / email_queue.rb
Created February 17, 2012 17:47
EmailQueue for Sidekiq
class EmailQueue
include Sidekiq::Worker
def perform(options)
mailer = options['mailer'].constantize
method = options['method']
args = options['args']
mailer.send(method, *args).deliver
end