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 / delayed_job_init_script.sh
Created April 11, 2016 14:56 — forked from mdesantis/delayed_job_init_script.sh
Delayed Job init script; it uses start-stop-daemon and supports every Ruby version manager (RVM, rbenv, chruby...)
#!/bin/sh
### BEGIN INIT INFO
# Provides: delayed_job
# Required-Start: $all
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the delayed_job instances
# Description: starts the delayed_job server instances using start-stop-daemon
#
@dgilperez
dgilperez / chat.rb
Created April 8, 2016 08:59 — forked from tlewin/chat.rb
#!/usr/bin/env ruby -I ../lib -I lib
# coding: utf-8
require 'rtoken'
require 'json'
require 'sinatra/base'
require 'thin'
class Chat < Sinatra::Base
@dgilperez
dgilperez / chat.rb
Created April 2, 2016 12:56 — forked from HoneyryderChuck/chat.rb
Simple Chat Application, proof of concept for hybrid of thread-server http with evented-server SSE.
# chat.rb
require 'sinatra/base'
# this also loads celluloid io, let's keep that in mind
require 'celluloid/current'
require 'reel'
# The chat server, an IO Event Loop held by the actor
# Collects connections (Reel Event Streams)
#
# Contrary to EventMachine, there is no event callback for
@dgilperez
dgilperez / puma.monitrc
Last active March 30, 2016 15:12 — forked from sudara/puma.monitrc
Example config needed to use monit with puma, monitoring workers for mem.
# this monit config goes in /etc/monit/conf.d
check process puma_master
with pidfile /data/myapp/current/tmp/puma.pid
start program = "/etc/monit/scripts/puma start"
stop program = "/etc/monit/scripts/puma stop"
group myapp
check process puma_worker_0
with pidfile /data/myapp/current/tmp/puma_worker_0.pid
@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"
@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;