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 temporary table u (id int primary key, whatever varchar); | |
\copy u from 'out-file.csv' quote '"' csv | |
# 20 sec | |
update the_actual_table set whatever = u.whatever from u where the_actual_table.id = u.id | |
# 37 minutes |
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
Sequel.connect ActiveRecord::Base.connection_config.merge(adapter: 'postgres') |
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
search: " lambda \{ \|([^\|]+)\| " | |
replace: " ->($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
# http://webcache.googleusercontent.com/search?q=cache:pM2SE1PFjwgJ:michal.muskala.eu/blog/2013/11/13/rspec-response-code-testing/+&cd=1&hl=en&ct=clnk&gl=us | |
# unless we're in a non-rack environment | |
# (which is unlikely when testing status codes, nonetheless possible) | |
require 'rack/utils' | |
module StatusMatchers | |
# We will use this simple class as our matcher engine | |
class BeStatus | |
def initialize(status) |
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
search: .([\w]+) \{ \|(.+)\| \2\.([\w_!\?]+) \} | |
replace: .$1(&:$3) | |
or | |
\{\s*\|(.+)\|\s*\1\.([\w_!?]+)\s*\} | |
(&:$2) |
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' | |
class MyApplicationController < ApplicationController | |
def hello | |
render text: 'hello' | |
end | |
end | |
describe MyApplicationController do | |
describe '#protect_from_forgery' do |
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 ActiveRecord::Base | |
def self.columns | |
super.reject do |column| | |
"#{table_name}.#{column.name}" == ENV['IGNORE_COLUMN'] | |
end | |
end | |
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
module ActiveAdmin | |
module Views | |
class Calendar < ActiveAdmin::Component | |
def build(page_presenter, collection) | |
self.content = collection.ai(html: true).html_safe | |
end | |
def self.index_name | |
"calendar" | |
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
while :; do bundle_benchmark; done |
OlderNewer