Skip to content

Instantly share code, notes, and snippets.

View gaygenius's full-sized avatar

José J. Capó gaygenius

  • San Francisco, CA
View GitHub Profile
@gaygenius
gaygenius / Gemfile
Created February 3, 2012 19:38
Rails 3.2.1 Gemfile for Heroku with haml, rspec and backbone.js
source 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'haml-rails'
gem 'rails-backbone'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
@gaygenius
gaygenius / Gemfile
Created February 3, 2012 19:52
Rails 3.2 Gemfile for Heroku
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3'
gem 'heroku'
@gaygenius
gaygenius / index.html.haml
Created February 3, 2012 20:26
Place index view using backbone.js (in app/views/places)
#places
:javascript
$(function() {
window.router = new BackboneJs.Routers.PlacesRouter({places: #{@places.to_json.html_safe}});
Backbone.history.start();
});
@gaygenius
gaygenius / groupPhotos.rb
Created November 3, 2013 19:24
Group photos that are grouped in date directories into month directories
#!/usr/bin/env ruby -w
require 'fileutils'
Dir.chdir('/users/josecapo/Pictures')
months = Dir['201?-??-??'].map {|date| date[0..6]}.uniq
months.each do |month|
FileUtils.mkdir_p(month)
Dir["#{month}-*"].each do |date|
@gaygenius
gaygenius / gist:1e57d165a77cae5df2cf
Created September 18, 2014 22:19
Query to pick the "starting OES id" for ingress from MySQL
WITH
config_oes_ids AS (
SELECT (config->>'precedingOESId')::integer AS id, organization_id
FROM connections
GROUP BY organization_id
),
max_deliv_oes_ids AS (
SELECT max(id) as id, organization_id
FROM deliverables
GROUP BY organization_id
@gaygenius
gaygenius / utc.sql
Created February 10, 2015 20:54
Saved new user targeting conditions on Chicken
mysql> SELECT * FROM user_targeting_conditions WHERE event_id = 1272920;
+-------+----------+-----------+
| id | event_id | condition |
+-------+----------+-----------+
| 14875 | 1272920 | cUS |
| 14876 | 1272920 | sCA |
+-------+----------+-----------+
2 rows in set (0.00 sec)
mysql> SELECT * FROM user_targeting_conditions WHERE event_id = 1272920;
@gaygenius
gaygenius / multivariate_notes.markdown
Last active April 12, 2016 19:53
Notes about Multivariate Tests for Sponsored Petitions (Upsells)

Notes about Multivariate Tests for Sponsored Petitions (Upsells)

Please see the document Post-Sign Logic Map for more information about the flow for Promoted Petitions and Sponsored Petitions.

Which user will see an upsell?

  1. A user who has previously signed a petition. We don’t show an upsell after the very first petition signed.
@gaygenius
gaygenius / JSON_response.rb
Last active August 29, 2015 14:16
Figuring out what is currently needed to render Sponsored Petitions (upsells) on Rails
REDIRECTS (301 http status code)
/p (petitions_path) if
user not identified
no previous signature
no lead-in petition found (missing or incorrect petition_id param)
(already happening -- we do nothing) OTHER DESTINATIONS per upsell_list_redirect
@gaygenius
gaygenius / JSON_response.markdown
Last active August 29, 2015 14:16
Rails API endpoint for after-sign sponsored ads

GET /soa/petition_ads/:id

(id is the lead-in petition id)

additional params:

  • (required) context=after_sign_sponsored
  • (required) locale
  • (required) country_code
  • (optional) include_phone_upsells (only if phone_petition is not in the user’s request)
  • (optional) source=fe-services-app
@gaygenius
gaygenius / keybase.md
Created August 15, 2015 16:30
Keybase proof

Keybase proof

I hereby claim:

  • I am gaygenius on github.
  • I am gaygenius (https://keybase.io/gaygenius) on keybase.
  • I have a public key whose fingerprint is 5F9D D3F4 4679 0144 9DC9 696F 9E23 7A2E E21E 3E6D

To claim this, I am signing this object: