Skip to content

Instantly share code, notes, and snippets.

View mattboldt's full-sized avatar

Matt Boldt mattboldt

View GitHub Profile
@mattboldt
mattboldt / Instructions.markdown
Last active December 20, 2017 20:31
Target Process Brancherizer
  • Copy contents of file into a tpbr located outside of any repos.
  • cd /YOUR-TPBR-DIR/
  • chmod +x tpbr
  • ln -s $PWD/tpbr /usr/local/bin/

Usage:

tpbr https://kalkomey.tpondemand.com/entity/19929-title-slug
#=> tp19929_title_slug
@mattboldt
mattboldt / s3-updater.rb
Last active July 5, 2019 13:20
Update S3 object metadata of an entire bucket using the AWS Ruby SDK
require 'aws-sdk'
require 'active_support'
require 'active_support/core_ext'
# http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Object.html#copy_to-instance_method
COPY_TO_OPTIONS = [:multipart_copy, :content_length, :copy_source_client, :copy_source_region, :acl, :cache_control, :content_disposition, :content_encoding, :content_language, :content_type, :copy_source_if_match, :copy_source_if_modified_since, :copy_source_if_none_match, :copy_source_if_unmodified_since, :expires, :grant_full_control, :grant_read, :grant_read_acp, :grant_write_acp, :metadata, :metadata_directive, :tagging_directive, :server_side_encryption, :storage_class, :website_redirect_location, :sse_customer_algorithm, :sse_customer_key, :sse_customer_key_md5, :ssekms_key_id, :copy_source_sse_customer_algorithm, :copy_source_sse_customer_key, :copy_source_sse_customer_key_md5, :request_payer, :tagging, :use_accelerate_endpoint]
Aws.config.update({
region: 'us-east-1',
credentials: Aws::Credentials.new(AWS_ACCESS_KEY, AWS_SECRET_KEY)
@mattboldt
mattboldt / Gemfile
Last active May 5, 2018 17:06
Berkshelf packaging your cookbooks and uploading them to S3
# frozen_string_literal: true
source "https://rubygems.org"
gem 'aws-sdk', '~> 2'
gem 'colorize'
@mattboldt
mattboldt / app.coffee
Last active August 26, 2015 20:50
Ember 2.0 currentUser
`import Ember from 'ember';`
`import Resolver from 'ember/resolver';`
`import loadInitializers from 'ember/load-initializers';`
`import config from './config/environment';`
`import TruncateTextHelper from 'dochub/helpers/truncate-text';`
`import DS from 'ember-data'`
App = Ember.Application.extend(
modulePrefix: config.modulePrefix
# Error in console
Assertion Failed: You must include an `id` for signature in an object passed to `push`
# API
class SignatureInviteSerializer < ActiveModel::Serializer
attributes :id
has_many :signatures
end

Add this line to your ~/.bash_profile

alias gitpush='afplay /[PATH TO SOUND].MP3 && git push'

Then run source ~/.bash_profile

Now when you want to push, run gitpush instead and listen to the sound of an air horn, an 808 bass boom, or maybe even an airplane liftoff.

<script language="javascript" type="text/javascript">var lO0='=oQKpkyJ8dCK0lGbwNnLn42bkBjM8xWYjlmboNWZ0BjM8NHdlxGMywHZlNmbhZHZhBjM8lHbpNXYlBjM8RnbhxGcvJ3Yh1kMywHdjVmbu92YllGfn5Wau5WdyBjM8RWZl5GMywXdvlVRzwHdzlGb5FGbwBjM8lncvR3YlJXaEBjM85WYwIDf0djM8JXZ29GayIDfyV2Znlmc0xnb0JmMywXZjlmdlRUawIDfjVWawIDfyVmdvB3bwBjM8JXZ0VHct92YwIDf0NWZu52bjBjM8lnch1WayBHfldGZlx2dv52awIDfkxWdvdHMyw3dllmVwIDfzVWamlGbw1WazBjM8RXYoRHMywHZ19GbjxHMxcmbpRGZhBHfw9mcEJXaBBjM8xWdmJXZ39GcwIDf05WayBHMywHevJGcvJHZwIDfzJXZkx2bmBjM8VGdzFGcwIDflZ3btBjM852bpR3Yl5mbvNGMyw3Zul2dvxGbhBjM8FWakVWTwIDf05WZtV2YhxGc81WYlJHdTV0M8dmbp1WYlJHdzxnchJWduVWbwIDfslWYtVGMywXYpZHMywXeuFWbwIDfkV3bsNEMywXZzFWZsBHMywHej9GZ8hHdwBHf0BHc8NHdvh2cuVWZyN2c8JUTTBjM8R3YlxWZzBjM8ZGZwx3cshHfzVmbpxWbhVmc0NHMywnbvlGdhJ3ZlRnbJBjM8dmbpN3clN2YhBjM8RnblRnbvNGf4NHb4xnclZXZ39GawIDfldWYuFWbwIDfzVmb1RVawIDfw9GdyIDf05WYXBjM8V2VFNDfwVWZrBjM8RHanlWYyR3cwIDfwVGdzBjM89WakVXYwIDf5FGbwBjM8VmbvdGMyw3ay92dwIDfFBjM8N3blRWa2BjM8RWZ0FmcnVGdulGMywnQNNFOywHWT9EMywnclRGbvZGMywnc19GMywnZpBjM8JXdPBjM8NXZpJ
App.Router.reopen
location: 'history'
App.Router.map ->
@resource('dashboard', path: '/', ->
@resource('user', path: '/:userSlug')
)
@resource('post', path: '/:ownerSlug/:hashId/:postSlug', ->
App.Router.reopen
location: 'history'
rootURL: '/u/'
App.Router.map ->
@resource('documents', path: '/')
@resource('document', path: '/:document_slug/:document_id')
App.DocumentRoute = Ember.Route.extend
# allows us to use slug as the url
App.Router.reopen
location: 'history'
rootURL: '/u/'
App.Router.map ->
@route 'login'
@resource('documents', path: '/')
@route('document', path: '/:document_id')
@resource('pages', path: '/:document_id/pages')