Skip to content

Instantly share code, notes, and snippets.

View louisebolden's full-sized avatar

Louise louisebolden

View GitHub Profile
@peterclark
peterclark / ruby-google-api-analyticsv3.rb
Last active May 1, 2020 02:19
Authentication with the Ruby Google API Client and Google Analytics API
# Create credentials json file
# 1. Go to Google API Console
# 2. Create credentials (Service Account Key). Note 'Service account ID'
# 3. Download key as 'google_auth.json'
# 4. Go to Google Analytics -> Admin -> View Settings. Note 'View ID'
# 5. Go to User Management -> Add permissions for: (Service account ID) [Read & Analyze]
# Terminal
export GOOGLE_APPLICATION_CREDENTIALS='config/google_auth.json'
@jkotchoff
jkotchoff / generate_twitter_bearer_token.rb
Last active April 27, 2023 23:10
Send Tweets to the Twitter API with an OAuth1 token
# Generate and use an oauth2 bearer token for the Twitter API in Ruby
#
# For Application-Only authentication to the twitter API, a 'bearer token'
# is required to authenticate agains their endpoints for rate limiting
# purposes.
#
# This script generates a bearer token by posting to twitter and then it
# uses that token to poll their API.
#
# Note, the base 64 encoded consumer credentials for the bearer token needs
@ryanwi
ryanwi / rails_new
Last active December 17, 2015 17:39
Create new Rails app with gemset, using postgresql
$ rvm use --create 2.1@app_name
$ gem install rails --no-ri --no-rdoc
$ rails new app_name --database=postgresql
$ cd app_name/
$ rvm --rvmrc 2.1@app_name
$ git init
$ git add .
# setup db
$ rake db:drop db:create db:migrate db:seed
@joost
joost / ruby_google_analytics_server_to_server.md
Last active November 27, 2023 15:43
Google Analytics API (server-to-server) using Ruby
@abhishek77in
abhishek77in / report.rb
Created December 9, 2012 19:31
Create a PDF Document using Prawn Library with header, footer and page numbering.
require "prawn"
Prawn::Document.generate("report.pdf") do
10.times do
start_new_page
end
repeat :all do
move_down 50
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';