Skip to content

Instantly share code, notes, and snippets.

View dgilperez's full-sized avatar
🌊
Build that!

David Gil dgilperez

🌊
Build that!
View GitHub Profile
@dgilperez
dgilperez / rack_sse.ru
Created March 23, 2016 21:21 — forked from raggi/rack_sse.ru
Rack SSE Example
# rack_sse.ru
#
# An example of basic real-time, single-room broadcast chat using Server Sent
# Events in plain old Rack. This example does NOT use hijack, or the async
# hacks, it just relies on a well implemented threaded Rack server (at time of
# writing this will therefore only work with puma!). Other servers should be
# fixed to support this, as it is pretty critical to how Rack *should* work on
# most servers. The only spec-acceptable failure in this case is not flushing
# the content stream on each yield (for which the rack spec has no workaround
# today).
@dgilperez
dgilperez / deploy.rb
Created March 23, 2016 16:02
Deply Rails App with Puma and Nginx via Mina
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'esdb.cn'
set :identity_file, '/User/somebody/.ssh/somebody.pem'
set :deploy_to, '/home/ubuntu/apps/xxx.com'
set :repository, 'ssh://git@bitbucket.org/somebody/xxx.com.git'
set :branch, 'master'
@dgilperez
dgilperez / Gemfile
Created March 22, 2016 19:20 — forked from ctalkington/Gemfile
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"

Keybase proof

I hereby claim:

  • I am dgilperez on github.
  • I am dgilperez (https://keybase.io/dgilperez) on keybase.
  • I have a public key whose fingerprint is E724 8992 6628 F83C AE56 D709 D406 0F67 6925 6CF0

To claim this, I am signing this object:

@dgilperez
dgilperez / .eslintrc.js
Created December 15, 2015 13:58 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
.
├── actions
├── stores
├── views
│   ├── Anonymous
│   │   ├── __tests__
│   │   ├── views
│   │   │   ├── Home
│   │   │   │   ├── __tests__
│   │   │   │   └── Handler.js
@dgilperez
dgilperez / app
Created November 23, 2015 16:12 — forked from seyhunak/app
Varnish - Nginx - Unicorn Setup
upstream unicorn {
server unix:/tmp/unicorn.app.sock fail_timeout=0;
}
# HTTP server
#
server {
listen localhost:8080;
server_name app.me;
@dgilperez
dgilperez / call_template.rb
Created September 29, 2015 18:47 — forked from juggy/call_template.rb
Render a complete page in rails 3 without controller
# create the template
template = PageOfflineTemplate.new
template.quote = quote
template.pages = quote.build_pages
# Here I render a template with layout to a string then a PDF
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml")
@dgilperez
dgilperez / README.md
Created September 23, 2015 00:55 — forked from mbostock/.block
Save SVG as PNG

Say you have an SVG built dynamically on the client by D3. Now say you want to save it to a static PNG as a fallback for old browsers. There are lots of ways to do this using alternative renderers (such as Batik and PhantomJS), but what if you want your browser to do it, so that you the static PNG matches the dynamic SVG exactly, down to the subpixel, including transparency?

Here’s how.

1. Save as SVG.

Use the SVG Crowbar bookmarklet to save the SVG to a file. Call this file “fallback.svg”. Open the SVG in your browser to verify that it looks right.

SVG Crowbar helpfully inlines any stylesheets you may have on the page, but you might find you need to edit a few of the styles by hand to get things to look right. For example, the font-family “sans-serif” won’t work in an SVG image, even though it works when the SVG is built client-side; you’ll have to make the font name explicit, s

@dgilperez
dgilperez / README.md
Last active September 15, 2015 13:49 — forked from mtigas/README.md
this is the nginx config for https://mike.tig.as/, with config to avoid the BEAST exploit (by using TLS 1.2+ ciphers or RC4) and enable SSL perfect forward secrecy (by preferring ECDHE ciphers)

[mike.tig.as][mta] server configuration

This gist contains the nginx and tor configurations for the [mike.tig.as][mta] servers, mainly to show:

  • Use of the chris-lea/nginx-devel PPA to allow use of SPDY.
  • ssl_ciphers selection to mitigate BEAST attack, enable [perfect forward secrecy][pfs] if possible and select the strongest possible ciphers within those bounds. (Exception is made for several ciphers at the end of list, for compatibility reasons.)