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 / index.html
Last active March 27, 2020 00:17
Move object with buttons
<div id="container"></div>
@gaygenius
gaygenius / docker-tour.md
Created February 21, 2020 18:52
# Docker tour (Python web app with Redis service)

Docker tour (Python web app with Redis service)

From Docker docs — Get started

concepts

Stack
A group of interrelated services that share dependencies, can be orchestrated and scaled together (e.g., add visualizer and redis services).
Swarm
@gaygenius
gaygenius / nextjs-typescript.md
Last active February 15, 2020 17:41
Next.js with TypeScript

Next.js with TypeScript

setup

npm init next-app ~/code/next-ts && code ~/code/next-ts
npm i -D typescript @types/react @types/node
git rm -f index.js
@gaygenius
gaygenius / a_kind_of_spec.rb
Last active May 3, 2017 23:16
Correct use of rspec matching
describe 'Expectations' do
it 'fails with the wrong expectations' do
my_hash = { 'created_at' => Time.now }
expect(my_hash['created_at']).to be_a_kind_of(Time)
# expect(my_hash)
# .to eql({ 'created_at' => a_kind_of(Time) })
# expect(my_hash)
# .to eq({ 'created_at' => a_kind_of(Time) })
@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:

@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 / 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 / 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 / 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 / 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