Skip to content

Instantly share code, notes, and snippets.

View sescobb27's full-sized avatar
🇨🇴
sisas parce

Simon Escobar Benitez sescobb27

🇨🇴
sisas parce
View GitHub Profile
@sescobb27
sescobb27 / service-checklist.md
Created September 15, 2016 00:58 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@sescobb27
sescobb27 / observer.md
Created September 14, 2016 21:57 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
#!/usr/bin/env ruby
require 'net/http'
require 'json'
def create_deployment(sha)
uri = URI('https://api.github.com/repos/envoy/garaje/deployments')
req = Net::HTTP::Post.new(uri.path, {
'Content-Type' => 'application/json',
'Authorization' => "token #{ENV['GITHOUT_OAUTH_TOKEN']}"
@sescobb27
sescobb27 / Procfile
Created July 1, 2016 22:06 — forked from mojodna/Procfile
Getting Kue working on Heroku
web: node app.js
worker: node consumer.js
@sescobb27
sescobb27 / controller.js
Created June 6, 2016 15:49 — forked from khriztianmoreno/controller.js
Export to PDF, MEAN Stack
$http({
url: '/api/v1/reports/age-gender',
method: 'GET',
responseType: 'arraybuffer'
})
.success(function (data, status) {
var file = new Blob([data], {
type: 'application/pdf'
});
var fileURL = URL.createObjectURL(file);
@sescobb27
sescobb27 / record_to_list.hrl
Created April 8, 2016 14:58 — forked from gdamjan/record_to_list.hrl
An erlang macro that creates a function to convert a record to a key-value list
%%% This macro will create a function that converts a record to
%%% a {key, value} list (a proplist)
-define(record_to_list(Record),
fun(Val) ->
Fields = record_info(fields, Record),
[_Tag| Values] = tuple_to_list(Val),
lists:zip(Fields, Values)
end
).
@sescobb27
sescobb27 / proplist_to_record.hrl
Created April 8, 2016 14:58 — forked from gdamjan/proplist_to_record.hrl
Erlang macro to create proplist_to_record functions
%%% This is a clever Erlang macro that given a record name will create a new function
%%% that converts from a property list to the record (which really is a taged tuple).
-define(proplist_to_record(Record),
fun(Proplist) ->
Fields = record_info(fields, Record),
[Tag| Values] = tuple_to_list(#Record{}),
Defaults = lists:zip(Fields, Values),
L = lists:map(fun ({K,V}) -> proplists:get_value(K, Proplist, V) end, Defaults),
list_to_tuple([Tag|L])
@sescobb27
sescobb27 / component.js
Created March 10, 2016 02:33 — forked from c4milo/component.js
Simple breadcrumb Ember 2 component.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '', // Does not let Ember inject HTML into the component.
routing: Ember.inject.service('-routing'),
breadcrumbs: Ember.computed('routing.currentRouteName', function () {
let routeName = this.get('routing.currentRouteName');
let routeNames = routeName.split('.');
let len = routeNames.length;
@sescobb27
sescobb27 / json_api_relationships.rb
Created October 22, 2015 15:49 — forked from kurko/json_api_relationships.rb
JSONAPI Deserialization
module JsonApi
class Relationships
def initialize(record, payload, id_attr: :uuid)
@record = record
@payload = payload
@id_attr = id_attr
end
def set_relationships(*relations_names)
relations_names = Array.wrap(relations_names)