This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/https' | |
require 'uri' | |
class RunDMS | |
def self.snitch(id, options={}, &block) | |
dead_man = new(id, options) | |
block.call | |
dead_man.snitch | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="ISO-8859-1"?> | |
<?qbxml version="7.0"?> | |
<QBXML> | |
<QBXMLMsgsRq onError="continueOnError"> | |
<BillAddRq> | |
<BillAdd> | |
<TxnDate>2015-08-13</TxnDate> | |
<VendorRef> | |
<ListID>8000077D-1356714929</ListID> | |
</VendorRef> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="ISO-8859-1"?> | |
<?qbxml version="7.0"?> | |
<QBXML> | |
<QBXMLMsgsRq onError="continueOnError"> | |
<BillAddRq> | |
<BillAdd> | |
<VendorRef> | |
<ListID>80000438-1429823956</ListID> | |
</VendorRef> | |
<ItemLineAdd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Discussion < ActiveRecord::Base | |
include Tokenable | |
set_token_field_name :other_token_name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HEROKU_POSTGRESQL_GREEN was the old master | |
# I promoted then got rid of the original master (because it was staging) | |
# noticed that the follower was still a follower | |
➜ twinit.bauernet.me git:(split-test) heroku pg:info -r staging | |
=== HEROKU_POSTGRESQL_MAROON_URL (DATABASE_URL) | |
Plan: Standard 2 | |
Status: Available | |
Data Size: 7.76 GB | |
Tables: 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
around_action :set_timezone | |
def set_timezone | |
old_time_zone = Time.zone | |
Time.zone = current_user.time_zone | |
yield | |
ensure | |
Time.zone = old_time_zone | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- winning_count is a random number between 0 and 1 | |
-- times the sum of the weights | |
SELECT id | |
FROM ( | |
SELECT id, SUM(weight) OVER (ORDER BY id) S | |
FROM entries WHERE drawing_id = #{@drawing.id} | |
) Q | |
WHERE S >= winning_count | |
ORDER BY id | |
LIMIT 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE new_clone WITH TEMPLATE old_database; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'creating a person' do | |
it 'works with valid attributes' do | |
user = create(:user) | |
post "/api/people.json", | |
{ person: { name: 'Bob Johnson' } }, | |
{ 'Authorization' => "Token token=#{user.authentication_token}" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NullPhoto | |
def file | |
@file = OpenStruct.new( | |
url: 'https://dossi-prod.s3.amazonaws.com/default-avatar.png' | |
) | |
end | |
# is this kosher? | |
def blank? | |
true |
NewerOlder