Skip to content

Instantly share code, notes, and snippets.

View BRMatt's full-sized avatar

Matt Button BRMatt

View GitHub Profile
@BRMatt
BRMatt / bug.rb
Last active November 21, 2020 08:03
# Activate the gem you are reporting the issue against.
gem 'activerecord', if ENV['RAILS_3'] then '3.2.19' else '4.1.6' end
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# This connection will do for database-independent bug reports.
jQuery.fn.limitMaxlength = function(options){
settings = jQuery.extend({
attribute: "maxlength",
onInit: function(){},
onLimit: function(){},
onEdit: function(){}
}, options);
// Event handler to limit the textarea
@BRMatt
BRMatt / tf-multitaint
Last active August 6, 2018 11:28
A small utility for tainting a bunch of terraform resources in one go `terraform state list | grep launch_configuration | tf-multitaint`
#!/usr/bin/env ruby
resources = $stdin.readlines.map(&:split).flatten.map do |resource|
{
module: resource.scan(%r{module\.([a-z0-9\-_]+)}).to_a.join("."),
identifier: resource.match(%r{(?:module\.[a-z0-9\-_]+\.)*(.*)$}).captures.first,
}
end
resources.each do |resource|
{
"x_axis": {
"labels": [
"2000",
"2001",
"2002",
"2003",
"2004",
"2005"
]
@BRMatt
BRMatt / .gvimrc
Created May 5, 2010 15:36
My .vimrc and .gvimrc files
colorscheme twilight

Keybase proof

I hereby claim:

  • I am brmatt on github.
  • I am thatmatt (https://keybase.io/thatmatt) on keybase.
  • I have a public key ASCzUvNoJaxPkxvJVoltLkDSfhTvX6CmR-9V0V5ulm4CXgo

To claim this, I am signing this object:

@BRMatt
BRMatt / di.rb
Created December 17, 2013 12:13
module DependencyInjection
def inject(subject, *deps)
deps.each do |dep|
subject.send(:"#{dep}=", send(dep))
end
subject
end
end
<?php
function is_protected_post( $post_id = NULL ) {
global $post;
if ( $post_id === NULL )
$post_id = $post->ID;
foreach ( array(Memberful_Post_ACL::PRODUCT, Memberful_Post_ACL::SUBSCRIPTION) as $check ) {
@BRMatt
BRMatt / repo-gems.txt
Last active December 27, 2015 01:49
devise versions
Resolving dependencies... [86/1812]
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.12)
Using thread_safe (0.1.2)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
require 'resque'
require 'resque_scheduler'
require 'sidekiq'
ENV['REDIS_URL'] = ENV['REDISTOGO_URL'] if ENV['REDISTOGO_URL']
delayed_jobs = Resque.delayed_queue_peek(0, 5000)
to_insert = delayed_jobs.inject([]) do |result, timestamp|
jobs_at_time = Resque.delayed_timestamp_peek(timestamp, 0, 50000).map do |hash|