Skip to content

Instantly share code, notes, and snippets.

Avatar

Pedro Belo pedro

  • San Francisco, CA
  • @ped
View GitHub Profile
View rooftop.md

Pedro's Amazing Guide To Rooftop Bars

Drinking with a perspective

Very few people respect the art of rooftop drinking these days.

Notably, rooftop bar customers often believe that wearing a suit or a fancy dress conveys respect.

Niclekback wears suits

View ruby-graphql-enum.diff
+++ b/app/graph/types/day_of_the_week_enum.rb
@@ -0,0 +1,10 @@
+DayOfTheWeekEnum = GraphQL::EnumType.define do
+ name "Day of the week"
+ value("MONDAY", "Monday", value: 1)
+ value("TUESDAY", "Tuesday", value: 2)
+ value("WEDNESDAY", "Wednesday", value: 3)
+ value("THURSDAY", "Thursday", value: 4)
+ value("FRIDAY", "Friday", value: 5)
+ value("SATURDAY", "Saturday", value: 6)
@pedro
pedro / netflix-maintaining-resilient-front-door.md
Created Nov 13, 2014
Maintaining a resilient front door at massive scale, from Netflix
View netflix-maintaining-resilient-front-door.md

Maintaining a resilient front door at massive scale, from Netflix

  • Netflix is responsible for about 1/3 of downstream traffic in NA

  • Responsible team in the company is called "edge engineering"

    • Apart from resiliency/scaling, also cares about high velocity product innovation and real time health insights
  • Basic architecture:

    • end-user devices make requests to ELBs, which delegates to zuul, which routes to origin servers serving APIs
View parsing.html
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>JSON Parsing Tests</TITLE>
<LINK rel="stylesheet" type="text/css" href="style.css">
<META charset="UTF-8">
</HEAD>
View gist:1288447

Sample PHP+Mongo app on Heroku

  1. Install any of the Mongo add-ons available at http://addons.heroku.com

  2. Vendor the Mongo driver with your application. You can download it here:

    https://github.com/wuputah/heroku-libraries/raw/master/php/mongo/mongo.so
    

    Add it to a folder like "ext".

@pedro
pedro / RCTPushNotificationManager.h
Created Jul 12, 2016
Push Notifications error patch for React Native in iOS
View RCTPushNotificationManager.h
// Push notification manager from react-native 0.28, plus patch to handle errors correctly:
// https://github.com/facebook/react-native/pull/4277
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
View select-over-and-partition.md

Given a stupid table:

# SELECT * FROM sample;
 id | foo | bar 
----+-----+-----
 10 | a   | a
 11 | a   | b
 12 | a   | b
 13 | a   | c
View test_stats_on_pulls.rb
require "rubygems"
require "octokit"
# get an access token at https://github.com/settings/tokens/new
token = ENV["TOKEN"] || abort("missing TOKEN")
repo = ENV["REPO"] || abort("missing REPO. eg: pedro/devdigest")
client = Octokit::Client.new access_token: token
stats = Hash.new(0)
@pedro
pedro / rank-pulls.rb
Last active Dec 27, 2015
Quick hacky script to rank closed pull requests on a repo in hopes to answers "what happened last year?". Requires gems octokit and peach.
View rank-pulls.rb
require "rubygems"
require "octokit"
require "peach"
# warning! this will make a crapton of requests under your account.
# you might want to review/tweak the values below, or disable
# auto_paginate to test things first.
# get an access token at https://github.com/settings/tokens/new
token = ENV["TOKEN"] || abort("missing TOKEN")
You can’t perform that action at this time.