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 MyCode | |
def speak | |
"hello" | |
end | |
def do_something! | |
call_external_service | |
call_another_service("some parameter") | |
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 File.join(File.dirname(__FILE__), "test_helper") | |
require 'my_code' # this is what I will be testing in this unit test | |
class MyFirstTest < Test::Unit::TestCase | |
context "testing something fun" do | |
setup do | |
# in this case MyCode makes a call to an external service | |
# for this test, I want to stub out method "call_external_service" | |
# for more stubbing examples: http://flexmock.rubyforge.org/ |
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
mongrel@es-mongrel1:/var/log/cft/mailer$ sudo monit status | |
The monit daemon 4.10.1 uptime: 15d 2h 8m | |
System 'es-mongrel1' | |
status running | |
monitoring status monitored | |
load average [0.27] [0.21] [0.12] | |
cpu 1.7%us 0.3%sy 0.0%wa | |
memory usage 848956 kB [47.6%] | |
data collected Thu Jan 6 22:08:59 2011 |
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
# untested | |
class WrappedException < RuntimeException | |
def initialize(msg_or_exception) | |
if msg_or_exception.respond_to?(:backtrace) | |
@parent_backtrace = msg_or_exception.backtrace | |
end | |
super(msg_or_exception) | |
end | |
def backtrace |
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
-------- Storage Engine Statistics ------------------------------------------- | |
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster | |
[--] Data in MyISAM tables: 182M (Tables: 79) | |
[--] Data in InnoDB tables: 1M (Tables: 77) | |
[!!] Total fragmented tables: 77 | |
-------- Security Recommendations ------------------------------------------- | |
[!!] User 'root@127.0.0.1' has no password set. | |
[!!] User 'root@localhost' has no password set. | |
[!!] User 'root@skwp-mbp.local' has no password set. |
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
# Instructions for this test: | |
# 1. Please clone this gist as a git repo locally | |
# 2. Create your own github repo called 'rubytest' (or a name of your choice) and add this repo as a new remote to the cloned repo | |
# 3. Edit this file to answer the questions, and push this file with answers back out to your own 'rubytest' repo. | |
# Problem 1. Explain briefly what this code does, fix any bugs, then clean it up however you | |
# like and write a unit test using RSpec. | |
def bracketed_list(values) | |
temp="" |
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
" Run the current file in a ConqueTerm, great for ruby tests | |
let g:ConqueTerm_InsertOnEnter = 0 | |
let g:ConqueTerm_CWInsert = 1 | |
nmap <silent> <Leader>r :call RunRubyCurrentFileConque()<CR> | |
nmap <silent> <Leader>R :call RunRakeConque()<CR> | |
nmap <silent> <Leader>c :execute 'ConqueTermSplit script/console'<CR> | |
nmap <silent> <Leader>i :execute 'ConqueTermSplit pry'<CR> | |
nmap <silent> <Leader>b :execute 'ConqueTermSplit /bin/bash --login'<CR> | |
nmap <silent> <Leader>S :call RunRspecCurrentFileConque()<CR> |
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
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
interactive = auto | |
ui = auto | |
[gc] | |
auto = 1 | |
[merge] | |
summary = true |
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
" Find references to the currently opened partial | |
" by pressing P in command mode | |
function GitGrepCurrentPartial() | |
:call GitGrep(substitute(substitute(substitute(expand('%<'),'.*\/','','g'), '^_','','g'),'.html','','g')) | |
endfunction | |
command! GitGrepCurrentPartial call GitGrepCurrentPartial() | |
nnoremap <silent> P :GitGrepCurrentPartial<CR> | |
" Find references to current word, hit K | |
nnoremap <silent> K :GitGrep <cword><CR> |
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
function logCall() { | |
console.log(logCall.caller.name + '(' + | |
Array.prototype.slice.call(logCall.caller.arguments) | |
.map(JSON.stringify).join(', ') + | |
')'); | |
} |