- If you go red, undo
- Only change one line at a time
- Find two strings that are the most alike
- Find the smallest difference
- Make the smallest change that make the tests pass
| -- how to model threaded comments (e.g. reddit comments) in SQL with a simple 'ancestors' column | |
| -- The comment tree: | |
| -- [1] | |
| -- / \ | |
| -- [2] [4] | |
| -- / \ \ | |
| -- [3] [7] [6] | |
| -- / | |
| -- [5] |
| import re | |
| from django.core.urlresolvers import reverse | |
| import responses | |
| AWS_URL = re.compile('.*amazonaws.com.*') | |
| class TestSNSSubscription(object): |
| " If you use Vim, and tmux, you should be using Vimux: https://github.com/benmills/vimux | |
| " This snippet will let you easily zoom Vimux's runner pane to fullscreen. | |
| " It's really helpful for seeing more of a stack trace. | |
| " Requires tmux >= 1.8 | |
| " Function to tell Vimux to have make tmux zoom its runner pane. | |
| function! VimuxZoomRunner() | |
| call VimuxInspectRunner() | |
| call system("tmux resize-pane -Z") | |
| endfunction |
| TUNNELING | |
| Expose server port 456 on local port 123 | |
| $ ssh -L 123:localhost:456 [email protected] | |
| Transparent SOCKS proxy on localhost:12345 | |
| $ ssh -D 12345 [email protected] |
| require 'capybara/firebug' | |
| # Disable Webmock if needed. | |
| WebMock.disable_net_connect!(allow_localhost: true) | |
| # Same thing for VCR if it has been imported somewhere. | |
| VCR.configure do |c| | |
| c.ignore_localhost = true | |
| end | |
| ENV['NO_PROXY'] = ENV['no_proxy'] = '127.0.0.1' |
| 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 |
If Animal and Fozzie wanted to pair on Animals machine and they both have access to shared.muppets.com then they could use the following setup
~/.ssh/configHost tunnel_from_muppets
Hostname space.muppets.com
RemoteForward 1235 localhost:22