As configured in my dotfiles.
start new:
tmux
start new with session name:
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| # Install pow | |
| $ curl get.pow.cx | sh | |
| # Install powder | |
| $ gem install powder | |
| # See that firewall is fucked | |
| $ sudo ipfw show | |
| 00100 0 0 fwd 127.0.0.1,20559 tcp from any to me dst-port 80 in <- THIS ONE!!! | |
| 65535 81005 28684067 allow ip from any to any |
| # encoding: UTF-8 | |
| Capistrano::Configuration.instance(:must_exist).load do | |
| namespace :rails do | |
| desc "Open the rails console on one of the remote servers" | |
| task :console, :roles => :app do | |
| hostname = find_servers_for_task(current_task).first | |
| exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'" | |
| end | |
| end |
| from geventwebsocket.handler import WebSocketHandler | |
| from gevent.pywsgi import WSGIServer | |
| from flask import Flask, request, render_template | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return render_template('index.html') |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/ | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| #!/usr/bin/python | |
| # Equivalent of "tail -f" as a webpage using websocket | |
| # Usage: webtail.py PORT FILENAME | |
| # Tested with tornado 2.1 | |
| # Thanks to Thomas Pelletier for it's great introduction to tornado+websocket | |
| # http://thomas.pelletier.im/2010/08/websocket-tornado-redis/ | |
| import tornado.httpserver |
| # Use: it { should accept_nested_attributes_for(:association_name).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })} | |
| RSpec::Matchers.define :accept_nested_attributes_for do |association| | |
| match do |model| | |
| @model = model | |
| @nested_att_present = model.respond_to?("#{association}_attributes=".to_sym) | |
| if @nested_att_present && @reject | |
| model.send("#{association}_attributes=".to_sym,[@reject]) | |
| @reject_success = model.send("#{association}").empty? | |
| end | |
| model.send("#{association}").clear |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| class ActionDispatch::Routing::Mapper | |
| def draw(routes_name) | |
| instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
| end | |
| end | |
| BCX::Application.routes.draw do | |
| draw :api | |
| draw :account | |
| draw :session |
| @interface myViewController: UIViewController <CLLocationManagerDelegate> | |
| CLLocationManager *locationManager; | |
| CLLocation *currentLocation; | |
| @end |