This file contains hidden or 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
| curl http://cloud.github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7.pkg > /tmp/GCC-10.7.pkg && | |
| sudo installer -pkg /tmp/GCC-10.7.pkg -target / |
This file contains hidden or 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
| $ rake deploy | |
| > Executing deploy | |
| > Executing deploy:update | |
| > Executing deploy:update_code | |
| > Executing deploy:finalize_update | |
| > Executing bundle:install | |
| > Executing link_config | |
| > Executing link_files | |
| > Executing build_assets | |
| > Executing deploy:symlink |
This file contains hidden or 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
| diff --git a/gc.c b/gc.c | |
| --- a/gc.c | |
| +++ b/gc.c | |
| @@ -416,7 +416,6 @@ | |
| malloc_limit_ptr = getenv("RUBY_GC_MALLOC_LIMIT"); | |
| if (malloc_limit_ptr != NULL) { | |
| int malloc_limit_i = atoi(malloc_limit_ptr); | |
| - printf("malloc_limit=%d (%d)\n", malloc_limit_i, initial_malloc_limit); | |
| if (malloc_limit_i > 0) { | |
| initial_malloc_limit = malloc_limit_i; |
This file contains hidden or 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
| # Used with: | |
| # gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git' | |
| if Rails.env.development? | |
| def after_task(task_name, &new_task) | |
| old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s) | |
| desc old_task.full_comment | |
| task task_name do | |
| old_task.invoke | |
| new_task.call |
This file contains hidden or 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
| ...................................... | |
| Finished in 0.03768 seconds | |
| 38 examples, 0 failures | |
| real 0m0.386s | |
| user 0m0.344s | |
| sys 0m0.038s | |
| Later on... |
This file contains hidden or 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 CPU | |
| def self.current_usage | |
| process_usages = `ps -eo pcpu` | |
| total_usage = process_usages.split("\n").inject(0) { |sum, usage| sum += usage.strip.to_f } | |
| (total_usage / count).to_i | |
| end | |
| def self.count | |
| case RUBY_PLATFORM |
This file contains hidden or 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
| -------------------------------------------------- | |
| lib/foo.rb:22:in `save' | |
| # foo.book | |
| >> REQUEST: | |
| { | |
| "CashBook_Book": { | |
| "cashBookHandle": { | |
| "Number": "14" |
This file contains hidden or 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 'savon' | |
| require 'active_support' | |
| require 'active_support/core_ext' | |
| require 'json' | |
| # Don't mention the adapter! | |
| HTTPI.log = false | |
| # Log pretty JSON instead of XML, and never mind URL and headers. |
This file contains hidden or 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 'socket' | |
| class Graphite | |
| def initialize(host) | |
| @host = host | |
| end | |
| def socket | |
| return @socket if @socket && [email protected]? | |
| @socket = TCPSocket.new(@host, 2003) |
This file contains hidden or 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
| def add_load_path(path) | |
| full_path = "#{ENV["HOME"]}/.rvm/gems/ruby-version@project/#{path}" | |
| raise("load path missing: #{full_path}") unless File.exists?(full_path) | |
| $: << full_path | |
| end | |
| rails_version = File.readlines(File.join(File.dirname(__FILE__), "../../Gemfile")). | |
| find { |line| line.include?("'rails'") }.split.last.gsub("'",'') | |
| add_load_path "bundler/gems/draper-version/lib" |