def respond_with_paginated(collection)
%w( current_page
total_pages
total_count
prev_page
next_page
first_page?
last_page?
).each do |method_name|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/scp' | |
# ... code ... | |
puts "==> Downloading #{remote_path}" | |
Net::SCP.download!(hostname, username, remote_path, local_path) do |c,n,r,t| | |
pct = r / t.to_f | |
cnt = ( 72 * pct ).ceil | |
print "%-72s %.2f%%\r" % [ ("#" * cnt), ( pct * 100 ) ] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# post-receive | |
# | |
# Broadcast commit messages when pushed to the repositories master branch. | |
# | |
#== Git Configuration Example | |
# [notify] | |
# jabber = foo bar | |
# | |
require 'rubygems' | |
require 'jabber4r/jabber4r' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# mongod | |
# | |
# chkconfig: 2345 | |
# description: Scalable, high-performance, open source, document-oriented | |
# database. Written in C++. | |
# | |
# processname: mongod | |
# pidfile: /var/run/mongod.pid | |
# config: /etc/mongod.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# redis Advanced key-value store | |
# | |
# chkconfig: 2345 | |
# description: Redis is an open source, advanced key-value store. It is often | |
# referred to as a data structure server since keys can contain | |
# strings, hashes, lists, sets and sorted sets. | |
# processname: redis-server | |
# pidfile: /var/run/redis.pid | |
# config: /etc/redis.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#= sweep-tunes | |
require 'rubygems' | |
require 'broom' | |
if ARGV.size != 1 | |
puts "usage: sweep-tunes <path>" | |
exit | |
end |