Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cfabianski
cfabianski / tmux.md
Created December 7, 2015 08:52 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@cfabianski
cfabianski / rerun-bookmarklet.js
Created November 10, 2015 16:30 — forked from elandesign/rerun-bookmarklet.js
Rerun failed specs from Jenkins output
javascript:(function()%7Bfunction%20callback()%7Bvar%20output%20%3D%20%24(%22pre%22).text()%3Bvar%20failures%20%3D%20output.match(%2Frspec%20%5C.%5C%2F%5B%5E%20%5D%2B%2Fg)%3Bvar%20command%20%3D%20%22rspec%20%22%20%2B%20failures.map(function(s)%7Breturn%20s.match(%2F%5C.%5C%2F.*%2F)%5B0%5D%7D).join(%22%20%22)%3Bif(%24(%22%23rerun%22).length%20%3D%3D%200)%24(%22%23main-table%22).prepend(%22%3Cthead%3E%3Ctr%3E%3Ctd%20colspan%3D%5C%222%5C%22%20id%3D%5C%22rerun%5C%22%3E%22%20%2B%20command%20%2B%20%22%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Fthead%3E%22)%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fcode.jquery.com%2Fjquery-1.11.3.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
@cfabianski
cfabianski / migration_sql.rb
Created November 3, 2015 14:37 — forked from caius/migration_sql.rb
`bundle exec rake db:migrate > up.sql; migration_sql.rb < up.sql`
#!/usr/bin/env ruby
inside_migration = false
previous_line = ""
ARGF.each_line do |line|
# Remove ANSI colours to make shit easier to reason with
line.gsub!(/\e\[(\d+)(;\d+)*m/, "")
if line =~ /Migrating to/

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

#!/usr/bin/env ruby
gem 'activesupport'
gem 'pivotal-tracker'
require 'active_support/core_ext/string'
require 'pivotal_tracker'
API_TOKEN = "YOUR_API_TOKEN"
PROJECT_ID = "YOUR_PROJECT_ID"