Skip to content

Instantly share code, notes, and snippets.

View jpedrojpedro's full-sized avatar

João Pedro Pinheiro jpedrojpedro

View GitHub Profile
@chrisle
chrisle / simple_google_analytics.rb
Last active May 16, 2024 13:09
My simple Google Analytics API export API. Exports GA data as an array of flattened hashes with a SHA1 signature. No DSL, no sugar.
require 'digest'
# = simple_google_analytics.rb
#
# Chris Le <chris at iamchrisle dot com>
#
# This module is an wrapper to export data from Google Analytics as a flattened
# hash suitable for database storage. It does not require any other gems other
# than 'oauth'. I used this simply to get metrics and directly store them in
# a database.
@awesome
awesome / opposite_of_array_intersection.rb
Created January 21, 2010 17:44
Ruby opposite of array intersection
# Ruby opposite of array intersection... or maybe the method is missing from my brain bc not enough coffee
# http://twitter.com/soawesomeman/status/8035087261
def awesome(ar_1, ar_2)
(ar_1 + ar_2) - (ar_1 & ar_2)
end
awesome([1,2,3,4], [3,4,5,6]) # => [1, 2, 5, 6]