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
# --------- | |
# Prompt | |
# --------- | |
function gitprompt { | |
blue='\[\e[0;34;1m\]' | |
red='\[\e[0;38;1m\]' | |
green='\[\e[0;32;1m\]' | |
none='\[\e[0m\]' | |
prompt_info="" |
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 'ruby2ruby' | |
require 'parse_tree' | |
######################### | |
# Description: Dumps class source. Does not work for some core class. | |
# | |
# Example: MyClass.code | |
# | |
######################## | |
require 'ruby2ruby' |
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
git remote rm heroku | |
git remote add heroku [email protected]:newname.git |
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
source_url=source_url.com | |
app_name=app_name | |
# We download the full webside content | |
wget --mirror -r $source_url | |
# We move the web content into the rack public folder | |
mkdir -p $app_name/public | |
mv $source_url/* $app_name/public | |
rm -rf $source_url |
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
# Tmp files | |
*.orig | |
*.swp | |
*.dot | |
# Source control files | |
.hgignore | |
.hg* | |
**/*.svn | |
.svn |
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
class BlankSlate | |
instance_methods.each { |m| undef_method m unless m =~ /^__/ } | |
end | |
class MyProxy < BlankSlate | |
def initialize(obj, &proc) | |
@proc = proc | |
@obj = obj | |
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
require 'tempfile' | |
def vi(txt, arguments_str = "") | |
Tempfile.open('rubyview') do | file | | |
file << txt | |
file.close | |
cmd = "vim #{arguments_str} \"#{file.path}\"" | |
system( cmd ) | |
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
# Currently running gems | |
gems = Gem.loaded_specs.map{|name, spec| [name, spec.version.version]} | |
extend Hirb::Console | |
table gems |
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 RemoteCopy | |
def rmcp(filename) | |
s3_connect | |
full_path = File.expand_path(filename) | |
basename = File.basename(full_path) | |
S3Object.store("file_name.txt", basename, 'RemoteClipboard') | |
S3Object.store("content", File.open(full_path), 'RemoteClipboard') | |
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
AWS::S3::Base.establish_connection!( | |
:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'], | |
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY'] | |
) | |
def remote_serve(file_content, ext = "html", expires_in = 60 * 60 * 2 * 365) | |
# To generate a unique filename to avoid name colision | |
filename = Digest::SHA1.hexdigest(file_content + Time.now.to_s) + "." + ext.to_s | |
bucket_name = 'RemoteAccess' | |
obj = AWS::S3::S3Object.store(filename, file_content, bucket_name) |
OlderNewer