This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| package com.example.api; | |
| import java.util.Map; | |
| import retrofit.Call; | |
| import retrofit.http.Body; | |
| import retrofit.http.GET; | |
| import retrofit.http.POST; | |
| public interface Api { |
| public TimedHttpResponse send(final HttpRequestBase request, Header ... additionalHeaders) throws TimedHttpCommunicationException { | |
| String uriString = request.getURI().toString(); | |
| //set additional headers if any | |
| request.setHeader("Accept", "application/json"); | |
| //let's run the actual http execution in another thread then wait for it | |
| Future<HttpResponse> task = timeoutService.submit(new Callable<HttpResponse>() { | |
| @Override | |
| public HttpResponse call() throws Exception { | |
| HttpResponse response = execute(request); |
| $(document).on('click', '#sidebar a', function(e) { | |
| var fragment = $(this).data('fragment'); | |
| sscrollTo(fragment, e); | |
| }); |
| function mqScroll(element, target, event, callback) { | |
| $(element).scrollTop(target) | |
| preventDefault(event); | |
| return callback() | |
| } | |
| //usage | |
| mqScroll(scrollWith, targetY, event, function() { | |
| setTimeout(function() { |
| # Open ended | |
| # - What's your style of working. Pair programming vs solo | |
| # - What's your favortite pattern. Do you use any? | |
| # - If you accidentally pushed your branch to origin master, how would you restore | |
| # to a clean master? | |
| # - What have you been working on Sinatra and Node? Coffescript? APIs? how was it | |
| # architectured | |
| # Loading only one columsn and handling sum back in SQL | |
| # rails/activerecord. |
| class Washer | |
| attr_reader :name, :status | |
| @@num_washers = 0 | |
| @@num_washers_washing = 0 | |
| @@num_washers_rinsing = 0 | |
| def initialize(args = nil) | |
| @@num_washers += 1 | |
| @name = args[:name] | |
| end |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer