Skip to content

Instantly share code, notes, and snippets.

View vdel26's full-sized avatar

Victor Delgado vdel26

View GitHub Profile
@vdel26
vdel26 / applications_index.html
Created January 22, 2015 17:32
Filtering out deleted applications
<tbody>
{% for application in service.applications %}
{% unless application.plan.system_name == 'deleted' %}
<tr class="{% cycle 'applications': 'odd', 'even' %}" id="application_{{ application.id }}">
<td>
{{ application.name | link_to: application.url }}
</td>
{% if provider.multiple_services_allowed? %}
<td>{{ service.name }}</td>
{% endif %}
@vdel26
vdel26 / nginx.conf
Last active August 29, 2015 14:14
Inject extra fields to API backend
upstream threescale_admin_api {
# 3scale adminstration API
server MYCOMPANY-admin.3scale.net:443 max_fails=5 fail_timeout=30;
}
location = /threescale_appfind {
internal;
set $provider_key "PROVIDERKEY";
proxy_pass "https://threescale_admin_api/admin/api/applications/find.xml?provider_key=$provider_key&app_id=$app_id";
@vdel26
vdel26 / apis.md
Last active November 20, 2018 16:44
APIs

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
# "Performance Scalability of a Multi-Core Web Server", Nov 2007
# Bryan Veal and Annie Foong, Intel Corporation, Page 4/10
fs.file-max = 5000000
net.core.netdev_max_backlog = 4096
net.core.optmem_max = 10000000
net.core.rmem_default = 10000000
net.core.rmem_max = 10000000
net.core.somaxconn = 4096
net.core.wmem_default = 10000000
net.core.wmem_max = 10000000
@vdel26
vdel26 / Intertial-rotating-animation.markdown
Created April 21, 2015 23:02
Intertial rotating animation
@vdel26
vdel26 / errors.lua
Last active August 29, 2015 14:21
errors.lua
local errors = {}
local AUTH_FAILED_STATUS = 403
local AUTH_FAILED_HEADERS = 'text/plain; charset=us-ascii'
local AUTH_FAILED_MESSAGE = 'Authentication failed'
local AUTH_MISSING_STATUS = 403
local AUTH_MISSING_HEADERS = 'text/plain; charset=us-ascii'
local AUTH_MISSING_MESSAGE = 'Authentication parameters missing'
@vdel26
vdel26 / documentation.html.liquid
Last active August 29, 2015 14:25
Using an external Swagger spec in Active Docs 2.0
<h1>Documentation</h1>
<p>Use our live documentation to learn about Hello World API</p>
<!--
Even if you are pulling from an external spec you need to specify a service here.
You can just create an empty spec and replace SPEC_NAME by the system_name of that
spec in 3scale.
-->
{% active_docs version: "2.0" service: "SPEC_NAME" %}
@vdel26
vdel26 / tools.md
Last active February 17, 2016 19:54
Useful tools when working with APIs