Skip to content

Instantly share code, notes, and snippets.

View renancarvalhoo's full-sized avatar

Renan A. Carvalho renancarvalhoo

  • Lisbon
View GitHub Profile
#!/usr/bin/env perl
use strict;
use warnings;
my $oi = comment_squid_oi();
#my $emb_34 = comment_squid_emb_34();
#my $emb_147 = comment_squid_emb_147();
sub comment_squid_oi {
@renancarvalhoo
renancarvalhoo / ar_to_hash.rb
Last active December 19, 2016 16:05 — forked from dkln/ar_to_hash.rb
Convert any Activerecord to a hash with all it's related objects
class Serializer < Struct.new(:object)
#w.association_cache.keys.include?
def to_hash
@hash ||= hash_object(object)
end
private
def hash_object(object)
hash = {}
@renancarvalhoo
renancarvalhoo / API.md
Created November 30, 2016 16:13 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@renancarvalhoo
renancarvalhoo / caches_action.rb
Last active July 13, 2018 19:31 — forked from marshluca/caches_action.rb
Rails Action Cache
class ListsController < ApplicationController
before_filter :authenticate, :except => :public
caches_page :public
caches_action :index, :if => proc do
!request.format.json? # cache if is not a JSON request
end
caches_action :show, :cache_path => { :project => 1 },
First of all, I'd like to thank you for the technical test, it was something I really enjoyed and it refreshed my memory of some architectural things
-------------------------------------------------
# Staff Engineer coding assignment
# Brief
Acme Corp. has an API service that allows registered users to fetch any information about the company and its wide array of products. It quickly became a very popular service and, to provide fair service to all users, a 10,000 API requests per-user monthly limit was added. Not long after the change, users started to report that their requests were very slow or not returning at all.