Skip to content

Instantly share code, notes, and snippets.

View sevenseacat's full-sized avatar
🏠
Working remotely

Rebecca Le sevenseacat

🏠
Working remotely
View GitHub Profile
@chrismccord
chrismccord / gist:57805158f463d3369103
Last active February 12, 2016 09:52
Phoenix Upgrade Instructions 0.13.x 0.14.0

First, bump your phoenix in mix.exs:

def deps do
  [{:phoenix, "~> 0.14"}, ...
end

phoenix_html

Update your phoenix_html version to 1.1.0 in mix.exs:

Pry::Commands.block_command 'r' do |*w|
run "show-routes" + ( w.present? ? " --grep '#{w.join ' '}'" : "" )
end
require 'sequel'
require 'pg'
DB1 = Sequel.connect('postgres://localhost/database_1')
DB2 = Sequel.connect('postgres://localhost/database_2')
DB1[:people].where(:whatever => "something").each do |person|
DB2[:people].insert(:name => person.name)
end
@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing
@willurd
willurd / web-servers.md
Last active April 20, 2025 00:42
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@parndt
parndt / pre-commit
Last active December 16, 2015 11:59 — forked from ideasasylum/pre-commit
Place this in ~/.git_template/hooks/pre-commit and chmod to 755. Now, ensure you have git >= 1.7.1 and run: git config --global init.templatedir '~/.git_template' Back in your repository, run git init again and the hook will appear.
#!/usr/bin/env ruby
spec_hits = []
checks = {
'_spec\.rb$' => ['focus:[:space:]*true'],
'\.rb$' => ['binding\.pry', 'debugger']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
@kincorvia
kincorvia / gist:4540489
Created January 15, 2013 17:54
VCR Depecrations
# Typically in Rails to use VCR we setup the RSpec config like so:
RSpec.configure do |config|
config.extend VCR::RSpec::Macros #deprecated
end
# This gives us access to the use_vcr_cassette method:
describe Reviewed::Article do
use_vcr_cassette 'article/grill'
end
require 'active_support/core_ext/array'
class FactoryGirl
attr_accessor :options
def self.create(model, options = {})
new(model, options)
end
def initialize(model, options)
% rspec spec.rb --format doc
Foo
when logged in as a user
should == "TEST VALUE"
Finished in 0.00047 seconds
1 example, 0 failures
module AuthenticationHelpers
def authenticated_as(roles, options=nil)
options = instance_eval(&options) if options.is_a? Proc
Array(roles).each do |role|
context "when logged in as a #{role}" do
before(:all) { @user = FactoryGirl.create role, *Array(options) }
after(:all) { DatabaseCleaner.clean }
before(:each) { sign_in @user }