Skip to content

Instantly share code, notes, and snippets.

View gavinhughes's full-sized avatar

Gavin Hughes gavinhughes

View GitHub Profile
[1] pry(#<ProfilesController>)> @user = current_user.dup
=> #<Sponsor _id: 4f065814421aa90df800001a, _type: "Sponsor", created_at: 2012-01-06 02:02:01 UTC, updated_at: 2012-01-06 02:03:25 UTC, email: "[email protected]", encrypted_password: "$2a$10$/ondEoQsfgQ2yzMCW8qasOTLdqJTszzHLH6Ice6wOwTV7yTJuncUe", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: 2012-01-06 02:02:15 UTC, last_sign_in_at: 2012-01-06 02:02:15 UTC, current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", confirmation_token: nil, confirmed_at: 2012-01-06 02:02:08 UTC, confirmation_sent_at: 2012-01-06 02:02:01 UTC, unconfirmed_email: nil, first_name: nil, last_name: nil, nickname: "Gavin", gender: nil, birthdate: 2002-02-02 00:00:00 UTC, preferred_relationship_types: [""], statement: "", first_specified_birthdate: 2002-02-02 00:00:00 UTC>
[2] pry(#<ProfilesController>)> current_user.reload
=> #<Sponsor _id: 4f065619421aa90df8000011, _type: "Sponsor", created_at: 2012-0
@gavinhughes
gavinhughes / Edit email.html.erb
Created January 8, 2012 21:45
Devise Issue #1553
<-- registrations/email/edit.html.erb -->
<h2>Change Email</h2>
<%= form_for(resource, :as => resource_name, :url => { registrations_email_path(resource) }, :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<div><p><strong>Current email:</strong></p>
<p><%= resource.email %></p></div>
@gavinhughes
gavinhughes / db_disconnect.rake
Created September 25, 2012 10:56
Rake task to disconnect postgres db
namespace :db do
desc "Drop postgresql db connections"
task :disconnect => :environment do
begin
ActiveRecord::Base.connection.select_all("select * from pg_stat_activity order by procpid;").each do |x|
ActiveRecord::Base.connection.execute("select pg_terminate_backend(#{x['procpid']})")
end
rescue
end
puts "DB sessions disconnected."
@gavinhughes
gavinhughes / gist:4552586
Created January 17, 2013 01:00
Gemfile for VCR FiberError debugging
source 'https://rubygems.org'
#
# Hack: Workaround1: http://railsapps.github.com/openssl-certificate-verify-failed.html
# source 'http://rubygems.org'
gem 'rails', '3.2.9'
gem 'bcrypt-ruby', require: 'bcrypt'
gem 'pg'
# Add support for pg data types. Not needed >= Rails 4.0
@gavinhughes
gavinhughes / readme.org
Last active August 31, 2018 18:51
Ledger Recur - Automated entry of recurring transactions into ledger files

Ledger Recur

Ledger Recur provides automated entry of recurring transactions into ledger files.

The command `recur journal.ledger recurring.rcr` enters all recurring transactions specified in the file `recurring.rcr` into the file `journal.ledger`.

A recur file is parsed before transactions are entered into a ledger file. If erorrs are found, they are reported and no transactions are entered.

Recur file syntax

@gavinhughes
gavinhughes / crash.txt
Created August 21, 2020 15:10
Emacs crash report
This file has been truncated, but you can view the full file.
Date/Time: 2020-08-21 11:07:59 -0400
End time: 2020-08-21 11:08:26 -0400
OS Version: Mac OS X 10.15.5 (Build 19F101)
Architecture: x86_64h
Report Version: 29
Data Source: Stackshots
Shared Cache: 0x26e8000 2CDD2B20-3DA2-39B1-9801-CE90D65CC62D
Command: Emacs