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
TUNNELING | |
Expose server port 456 on local port 123 | |
$ ssh -L 123:localhost:456 user@yourserver.com | |
Transparent SOCKS proxy on localhost:12345 | |
$ ssh -D 12345 user@yourserver.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
def wait_for(selector) | |
time_waiting = 0 | |
sleep_tick = 0.1 | |
num_matches = -> { page.evaluate_script("$('#{selector}').length").to_i } | |
while num_matches.call <= 0 do | |
time_waiting += sleep_tick | |
sleep(sleep_tick) | |
timeout_reached = time_waiting >= Capybara.default_wait_time | |
raise "Timeout reached while waiting for '#{selector}'" if timeout_reached | |
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
#Functions for lazy git commiting | |
#Instead of: git commit -m "some message" | |
#Type: gci some message | |
gci() { | |
if [ -z "$1" ] # Is parameter #1 zero length? | |
then | |
echo "You must pass a commit message like this: gci some message here - which then becomes: git commit -m 'some message here'" | |
else | |
git commit -m "$*" | |
fi |
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
Useful for when you need to have two hosts talk to each other on a specific port but they're both NATed (behind routers). | |
For example, you want to be able to SSH into your friend's machine to pair program with them. | |
host-machine$ ssh -R 55555:localhost:22 myaccount@my_ssh_server.com | |
connecting-machine$ ssh -L 55555:localhost:55555 myaccount@my_ssh_server.com | |
connecting-machine$ ssh -p 55555 user_on_host_machine@localhost |
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
d = (s) -> o = {}; o[k] = eval(k) for k in s.split(' '); console.log JSON.stringify(o, null, ' ') | |
# Or, the compiled JavaScript: | |
d = function(s) { | |
var k, o, _i, _len, _ref; | |
o = {}; | |
_ref = s.split(' '); | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
k = _ref[_i]; |
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
# These are my notes from the PragProg book on CoffeeScript of things that either | |
# aren't in the main CS language reference or I didn't pick them up there. I wrote | |
# them down before I forgot, and put it here for others but mainly as a reference for | |
# myself. | |
# assign arguments in constructor to properties of the same name: | |
class Thingie | |
constructor: (@name, @url) -> | |
# is the same as: |
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
> Number.prototype.seconds = function(){ return this * 1000 } | |
=> function (){ return this * 1000 } | |
> 1..seconds() | |
=> 1000 | |
> (1).seconds() | |
=> 1000 | |
> 1['seconds']() |
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
Autotest.add_hook :initialize do |at| | |
at.add_mapping(%r%^spec/integration/.*_spec.rb$%, true) { |filename, _| | |
filename | |
} | |
at.add_mapping(%r%^app/(models|controllers|helpers|lib)/.*rb$%, true) { | |
at.files_matching %r%^spec/integration/.*_spec.rb$% | |
} | |
at.add_mapping(%r%^app/views/(.*)$%, 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
LabelOne LabelTwo | |
- feature one (description one) | |
- feature two (description two) | |
- feature three with multiline desc following | |
desc line 1 | |
desc line 2 | |
desc line 3 |
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
grammar PivotalStories | |
rule stories | |
story* | |
end | |
rule story | |
feature* | |
end | |
rule feature |