Skip to content

Instantly share code, notes, and snippets.

View andrew-carroll's full-sized avatar

Andrew Carroll andrew-carroll

View GitHub Profile
gsub_file "Gemfile", /^\#.*\n/, ''
gsub_file "Gemfile", /^\n/, ''
gem_group :development, :test do
gem 'rspec-rails'
gem 'capybara'
gem 'factory_girl_rails'
end
gem 'slim-rails'
setw -g mode-keys vi
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
bind-key | split-window -h
bind-key - split-window -v
is_vim='echo "#{pane_current_command} | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
setw -g mode-keys vi
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
bind-key | split-window -h
bind-key - split-window -v
is_vim='echo "#{pane_current_command} | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
#!/usr/bin/env ruby
require 'watir-webdriver'
require 'webrick/httpproxy'
# USAGE: ./proxied_browser.rb server (port) [json]
# ./proxied_browser.rb browser (port)
class ProxiedBrowser < Watir::Browser
def initialize(port)
proxy = ['localhost',port].join(?:)
// Place all the styles related to the pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.splash {
@extend .col-xs-12;
background: linear-gradient(to bottom, rgba(20, 20, 80, 0.5) 0%, rgba(20, 20, 80, 0.5) 100%), url(hero2.jpg);
background-size: cover;
min-height: 85vh;
color: #DED;
@andrew-carroll
andrew-carroll / encfs.sh
Created August 4, 2015 05:53
Wrapper for encfs that allows relative paths.
#!/usr/bin/env bash
if [[ $# -ne 2 ]]; then
echo "Usage: $0 ./encrypted/dir ./visible/dir"
fi
/usr/bin/encfs $(readlink -f $1) $(readlink -f $2)
class CreateFriendships < ActiveRecord::Migration
def change
create_table :friendships do |t|
t.belongs_to :person, index: true, null: false, foreign_key: true
t.belongs_to :friend, index: true, null: false, foreign_key: true
t.timestamps null: false
end
end
end
#!/usr/bin/env ruby
pwd = `pwd`.strip
targets = if ARGV.empty?
Dir["#{pwd}/*"]
else
ARGV.map do |arg|
Dir["#{arg.strip.gsub(/\/*$/,'')}/*"]
end.flatten.uniq
end
require 'music_player'
require 'timer'
class AlarmClock
def initialize(music_player, timer)
@music_player = music_player
@timer = timer
end
def start
@timer.start { @music_player.start }
#!/usr/bin/env ruby
require 'webrick/httpproxy'
port = ARGV[0] or 8000
server = WEBrick::HTTPProxyServer.new(Port: port)
server.mount_proc('/'){|req,res|}
server.start