I hereby claim:
- I am thermistor on github.
- I am thermistor (https://keybase.io/thermistor) on keybase.
- I have a public key ASBiX2KnZb1zYnuWNsGrScjM7ZlOaPVS0bjWdF99-UlV3go
To claim this, I am signing this object:
# Takes a table name, and an array of hashes where keys are column names and values are values. | |
# Expects hashes to all contain the same keys. | |
def bulk_insert(table, rows) | |
columns = rows.first.keys | |
to_insert = rows.map do |d| | |
vals = columns.map {|k| d[k] } | |
ActiveRecord::Base.send(:replace_bind_variables, "(#{vals.length.times.collect {'?'}.join(',')})", vals) | |
end |
module Interactor | |
def require_in_context(*names) | |
context_keys = context.keys | |
names.each do |name| | |
if !context_keys.include?(name) | |
raise "Interactor #{self.class.name} requires #{name.inspect} but it wasn't found in context." | |
end | |
end | |
names.map do |name| | |
self.send(name) |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
// from https://gist.github.com/stinoga/8101816#gistcomment-1842990 | |
function setParam(uri, key, val) { | |
return uri | |
.replace(new RegExp("([?&]"+key+"(?=[=&#]|$)[^#&]*|(?=#|$))"), "&"+key+"="+encodeURIComponent(val)) | |
.replace(/^([^?&]+)&/, "$1?"); | |
} |
man() { | |
env \ | |
LESS_TERMCAP_mb=$(printf "\e[1;31m") \ | |
LESS_TERMCAP_md=$(printf "\e[1;31m") \ | |
LESS_TERMCAP_me=$(printf "\e[0m") \ | |
LESS_TERMCAP_se=$(printf "\e[0m") \ | |
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ | |
LESS_TERMCAP_ue=$(printf "\e[0m") \ | |
LESS_TERMCAP_us=$(printf "\e[1;32m") \ | |
man "$@" |
--- | |
# ^^^ YAML documents must begin with the document separator "---" | |
# | |
#### Example docblock, I like to put a descriptive comment at the top of my | |
#### playbooks. | |
# | |
# Overview: Playbook to bootstrap a new host for configuration management. | |
# Applies to: production | |
# Description: | |
# Ensures that a host is configured for management with Ansible. |
I hereby claim:
To claim this, I am signing this object:
require 'dotenv/tasks' | |
task notify_rollbar: :dotenv do | |
on roles(:app) do |h| | |
revision = `git log -n 1 --pretty=format:"%H"` | |
local_user = `whoami`.chomp | |
rollbar_token = ENV['ROLLBAR_ACCESS_TOKEN'] | |
rails_env = fetch(:rails_env, 'production') | |
execute :curl, "https://api.rollbar.com/api/1/deploy/ -F access_token=#{rollbar_token} -F environment=#{rails_env} -F revision=#{revision} -F local_username=#{local_user} >/dev/null 2>&1", :once => true | |
end |
require 'non_digest_assets' | |
namespace :assets do | |
task :non_digested do | |
NonDigestAssets.new.generate | |
end | |
end |
I've heard this before:
What I really get frustrated by is that I cannot wrap
console.*
and preserve line numbers
We enabled this in Chrome DevTools via blackboxing a bit ago.
If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.