I hereby claim:
- I am warp on github.
- I am altwarp (https://keybase.io/altwarp) on keybase.
- I have a public key ASD8yF1S8Va-UgQAWFdILJDMRQ92veQZYB6haa-somUlbgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Create and download backup | |
heroku pg:backups:capture | |
heroku pg:backups:download | |
# Assumes the database container is named 'db' | |
DOCKER_DB_NAME="$(docker-compose ps -q db)" | |
DB_HOSTNAME=db | |
DB_USER=postgres | |
LOCAL_DUMP_PATH="path/to/local.dump" |
require_relative 'environment' | |
app = Server.new do | |
trigger :turn_on_lightbulb do | |
# Make an API request... | |
Net::HTTP.post_form(URI('http://lightbulb.local'), 'status' => 'on') | |
# Response (any JSON-like data) | |
{ light_bulb: "on" } | |
end |
RSpec.configure do |config| | |
config.use_transactional_fixtures = false | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.strategy = :transaction | |
end |
module ActiveModel | |
class Serializer | |
class Adapter | |
class JsonFieldsets < Adapter | |
def initialize(serializer, options = {}) | |
super | |
if fields = options.delete(:fields) | |
@fieldset = fields.split(',').map(&:to_sym) | |
else |
#!/usr/bin/env ruby | |
content = File.open(ARGV[0], 'rb') {|io| io.read } | |
File.open(ARGV[0] + '.txt', 'w') do |file| | |
content.scan /Txt TEXT[\W]*([^\x0C]*)\x0C/ do |match| | |
s = $1.gsub(/\x00/, '').force_encoding('UTF-8') | |
file << s | |
puts s | |
end |
module PaperclipMigrations | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def add_paperclip_fields(table, prefix) | |
add_column table, "#{prefix}_file_name", :string | |
add_column table, "#{prefix}_content_type", :string |