Skip to content

Instantly share code, notes, and snippets.

@hotchpotch
hotchpotch / .pryrc
Created March 5, 2012 13:26
pry clipboard copy utility
def pbcopy(str)
IO.popen('pbcopy', 'r+') {|io| io.puts str }
output.puts "-- Copy to clipboard --\n#{str}"
end
Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n|
pbcopy _pry_.input_array[n ? n.to_i : -1]
end
Pry.config.commands.command "copy", "Copy to clipboard" do |str|
@johnthethird
johnthethird / cap_notify.rb
Created May 4, 2011 20:02 — forked from rtekie/cap_notify.rb
Capistrano deployment email notifier for Rails 3
=begin
Capistrano deployment email notifier for Rails 3
Do you need to send email notifications after application deployments?
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html.
Here is Rails 3 port of the notifier.
The notifier sends an email after application deployment has been completed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@somebox
somebox / redis-graphite.sh
Last active July 18, 2016 00:37
graphite-redis : monitor redis statistics with graphite across several hosts
#!/usr/bin/env ruby
require 'socket'
# This script runs every minute, captures stats about redis
# and forwards them to graphite as counter values.
# Graphite/carbon settings
GRAPHITE_HOST="graphite.intra.local.ch"
GRAPHITE_PORT=8125
# a Rack middleware component that enables ActiveRecord query caching
# To use, put "use QueryCaching" in your Sinatra app.
class QueryCaching
def initialize(app)
@app = app
end
def call(env)
if is_static_file?(env)
@arangamani
arangamani / jsonlint
Last active January 7, 2016 02:45
A JSON lint tool using Ruby and "json" Rubygem
#!/usr/bin/env ruby
require "rubygems"
require "json"
if ARGV.size < 1
puts "Please provide a JSON file"
exit 1
end
@happy15
happy15 / gist:2179728
Created March 24, 2012 07:40
wired benchmark: cuba vs sinatra
simple.rb
=========
require 'sinatra'
use Rack::CommonLogger
get '/' do
'hello'
end