Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'time'
require 'logger'
require 'rubygems'
require 'pingdom-client'
require 'active_support/core_ext/numeric/time' # time extensions, e.g., 5.days
require 'stashboard'
TIME_FORMAT = "%Y-%m-%d %H:%M:%S %Z" # YYYY-MM-DD HH:MM:SS ZZZ
#!/bin/sh
# Sublime Text 3 install with Package Control
# http://simonewebdesign.it/blog/install-sublime-text-3-on-fedora-20/
# Run this script with:
# $ curl LINK_TO_THIS_SCRIPT | sh
curl -o ~/st3.tar.bz2 http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3059_x64.tar.bz2

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
@duduribeiro
duduribeiro / gist:57453716cbd0aedcd8b4
Created October 6, 2014 19:33
ansible-id_rsa.ym;
---
- name: Configure Ansible
hosts: guests
user: root
tasks:
- name: Install Ansible
action: yum pkg=$item state=installed
with_items:
# Install redis with homebrew :)
$ brew install redis
# Create a deamon
$ sudo vim /Library/LaunchDaemons/io.redis.redis-server.plist
# Paste the following content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
class ApplicationController < ActionController::Base
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
def render_not_found
respond_to do |format|
format.html { render action: "errors/not_found.html.erb", status: 404 }
end
end
end
@duduribeiro
duduribeiro / br_sp_cel_mask.js
Created August 7, 2012 17:15
new mask for Brazil-São Paulo celphones (jquery)
$('#cel').mask("(99) 9999-9999?9").live('focusout', function(event) {
var target, phone, element;
target = (event.currentTarget) ? event.currentTarget : event.srcElement;
phone = target.value.replace(/\D/g, '');
element = $(target);
element.unmask();
if(phone.length > 10) {
element.mask("(99) 99999-999?9");
} else {
element.mask("(99) 9999-9999?9");
@duduribeiro
duduribeiro / gist:3777294
Created September 24, 2012 17:54 — forked from brunoandradd/gist:3777274
Config nginx com php/ruby
worker_processes 3;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.7;
passenger_ruby /usr/local/bin/ruby;
@duduribeiro
duduribeiro / introrx.md
Created December 19, 2015 18:09 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing