Skip to content

Instantly share code, notes, and snippets.

Avatar

Pedro Belo pedro

  • San Francisco, CA
  • @ped
View GitHub Profile
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)
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>
@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.
@pedro
pedro / init.r
Last active Aug 29, 2015
R + Redis on Heroku
View init.r
# used by the R buildpack to install dependencies:
# https://github.com/virtualstaticvoid/heroku-buildpack-r
install.packages("rredis", dependencies = TRUE)
@pedro
pedro / enqueue.r
Last active Aug 29, 2015
Running redis-based workers in R on Heroku
View enqueue.r
# same code used in https://gist.github.com/pedro/f931e8cd20b5770b6780
# only using doRedis instead of doParallel
library(foreach)
library(doRedis)
redis_url <- Sys.getenv("REDIS_URL")
host <- gsub("redis://.*@(.+):.*", "\\1", redis_url)
pass <- gsub("redis://.*:(.+)@.*", "\\1", redis_url)
port <- as.integer(gsub(".*:(.*)$", "\\1", redis_url))
registerDoRedis("jobs", host=host, port=port, password=pass)
@pedro
pedro / init.r
Last active Aug 29, 2015
Running R code in parallel on Heroku
View init.r
# used by the R buildpack to install dependencies:
# https://github.com/virtualstaticvoid/heroku-buildpack-r
install.packages("foreach", dependencies = TRUE)
install.packages("doParallel", dependencies = TRUE)
View gist:9232897015a43400c041
irb(main):018:0> RestClient::VERSION
=> "1.7.3"
irb(main):019:0> RestClient.get("http://test-affinity.herokuapp.com/")
=> "1"
irb(main):020:0> RestClient.get("http://test-affinity.herokuapp.com/").to_i
=> 200
irb(main):021:0> RestClient.get("http://test-affinity.herokuapp.com/").class
=> String
irb(main):022:0> RestClient.get("http://test-affinity.herokuapp.com/") == "1"
=> true
@pedro
pedro / jack-white-guac.md
Last active Aug 29, 2015
Jack White's guacamole recipe
View jack-white-guac.md

Jack White's guacamole recipe

Recently the tour rider for a Jack White performance was made public, and it contained a recipe for guacamole intended to be made for the artist.

Ingredients

  • 8x large ripe Haas avocados
  • 4x vine-ripened tomatoes (diced)
  • ½ yellow onion finely chopped
  • 4x Serrano pepper (de-veined and chopped)
@pedro
pedro / s3-performance.md
Created Nov 13, 2014
Maximizing S3 Peformance
View s3-performance.md

Maximizing S3 Peformance

  • 137% increase in AWS usage in the last year

  • Factors to keep in mind when picking a region

    • Performance: Proximity to users and to other resources in AWS
    • Compliance
    • Cost
  • Naming scheme is the most important thing

@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
You can’t perform that action at this time.