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 | |
require 'webrick/httpproxy' | |
require 'webrick/httpauth/digestauth' | |
require 'webrick/httpauth/userdb' | |
def ask question | |
STDOUT.print question | |
STDOUT.flush | |
gets.chomp | |
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
commit 1e4c620263077fa03b8fbc11104fde47d041f836 | |
Author: Elia Schito <[email protected]> | |
Date: Fri May 15 10:17:48 2009 +0200 | |
Added Thor::IncludableModule to automagically transform module methods into thor ones. | |
diff --git a/lib/thor/includable_module.rb b/lib/thor/includable_module.rb | |
new file mode 100644 | |
index 0000000..8cb821e | |
--- /dev/null |
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
# this works only on macs... | |
Autotest.add_hook :ran_command do |autotest| | |
results = [autotest.results].flatten.join("\n") | |
examples = results.scan(/(\d+) examples?/).flatten.first.to_i || 0 | |
failures = results.scan(/(\d+) failures?/).flatten.first.to_i || 0 | |
pending = results.scan(/(\d+) pending/).flatten.first.to_i || 0 | |
errors = results.scan(/(\d+) errors?/).flatten.first.to_i || 0 | |
if [examples, failures, pending, errors].any?{|v| v > 0} |
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 bash | |
# coding: utf-8 | |
# PROMPT | |
# more compact | |
# export PS1="\u@\h\w$ " | |
# export PS1=">: " # LOST style | |
# export PS1='> ' # Terminal Icon style |
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
# | |
# BitFields provides a simple way to extract a values from bit fields, | |
# especially if they don't correspond to standard sizes (such as +char+, +int+, | |
# +long+, etc., see <tt>String#unpack</tt> for further informations). | |
# | |
# For example the Primary Header of the Telemetry Frame in the ESA PSS | |
# Standard has this specification: | |
# | |
# | |
# | TRANSFER FRAME PRIMARY HEADER | |
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 'rubygems' | |
require 'eventmachine' | |
require 'em-http' # gem install em-http-request | |
require 'yajl' # gem install yajl-ruby | |
module ChatClient | |
def post_init | |
@name = "anonymous_#{ChatClient.client_num+=1}" | |
@sid = ChatClient.channel.subscribe(method(:send_msg)) | |
@buf = '' |
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 'aws/s3' | |
class << AWS::S3 | |
# The 3 S3 enpoints (http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RequestEndpoints.html). | |
ENDPOINTS = { | |
:us => 's3-us-west-1.amazonaws.com', | |
:asia => 's3-ap-southeast-1.amazonaws.com', | |
:europe => 's3-eu-west-1.amazonaws.com' | |
} |
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
module SocketWithStats | |
attr_reader :read_bytes | |
def read *args | |
@read_bytes ||= 0.bytes | |
got = super | |
@read_bytes += args.first | |
return got | |
end | |
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
# To include this custom prompt put this file in "~/bin/" and and put the | |
# following lines in "~/.profile". | |
# | |
# # Include Custom prompt | |
# . ~/bin/elia-git-prompt.sh | |
clear=$'\[\e[0m\]' | |
red=$'\[\e[31m\]' | |
green=$'\[\e[32m\]' |
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
Day job: | |
Your Rails contributions (if any): | |
What's your Ruby/Rail experience?: | |
How do you use GitHub?: |
OlderNewer