Skip to content

Instantly share code, notes, and snippets.

@nerf
nerf / keybase.md
Created February 21, 2019 16:50
keybase.md

Keybase proof

I hereby claim:

  • I am nerf on github.
  • I am nerf (https://keybase.io/nerf) on keybase.
  • I have a public key ASAbYQIeczNRrAVk-vQ_-tLkUmtj_7cJ8udWOgW5HAkWkAo

To claim this, I am signing this object:

@nerf
nerf / god.service
Created January 17, 2017 12:39
Systemd configuration for ruby God supervisor
[Unit]
Description=God: A process monitoring framework in Ruby
After=network.target
[Service]
Group=_USER_GROUP_
User=_USER_
ExecStart=/usr/local/sbin/god_startup start
ExecStop=/usr/local/sbin/god_startup stop
@nerf
nerf / hipchat_notify
Created October 8, 2014 12:31
hipchat notifications for shell commands
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'open3'
TOKEN = 'YOUR_TOKEN'
ROOM = 'ROOM_ID'
FROM='YOU_NAME'
COLOR='green'
@nerf
nerf / bootstrap_flash_messages.rb
Created October 4, 2012 11:54
Override Rails redirect_to flash messages to work with Twitter Bootstrap
module ActionController
module Flash
protected
def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
if alert = response_status_and_flash.delete(:alert)
flash[:alert] = alert
end
if success = response_status_and_flash.delete(:success)
flash[:success] = success
@nerf
nerf / gist:3818587
Created October 2, 2012 12:19
Bootstrap new rails project

Setup new rails 3 project with rspec, factory_girl, guard and spork

Init Rails project

rails new APP_NAME --skip-bundle --skip-test-unit

The Gemfile - pry, rspec, factory_girl, capybara, guard, shoulda and spork

gem 'pry-rails', group: :development  
  
group :development, :test do  

gem 'debugger'

@nerf
nerf / document_helper.rb
Created February 22, 2012 13:23
Convert numbers to Bulgarian words - list of numbers is incomplete (and It's not intended to be complete)
# Example
# in template: <%= number_to_bg_words something.price, :format => '%i и %f' %>
# result: триста и дванадесет лева и петдесет и шест стотинки
########################
# encoding: UTF-8
module DocumentHelper
@@number_to_word = {
'1' => 'един',
'2' => 'два',