Skip to content

Instantly share code, notes, and snippets.

@dlackty
dlackty / aws-sdk.rb
Created October 3, 2016 18:21
Fixing for AWS SDK for Ruby under multi-threading environment
# config/initializers/aws-sdk.rb
require "aws-sdk"
# Threading in modern rails means the AWS autoloading can lead to partially
# loaded namespaces unless we eager load up front. But only do it when we're
# eager loading generally (in production).
Rails.application.config.before_eager_load do
Aws.eager_autoload!
end
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@milesmatthias
milesmatthias / directory_upload.rb
Created September 1, 2014 00:57
S3 directory upload in ruby. Switched http://avi.io/blog/2013/12/03/upload-folder-to-s3-recursively to use the official aws ruby sdk.
#!/usr/bin/env ruby
require 'rubygems'
require 'aws-sdk'
class S3FolderUpload
attr_reader :folder_path, :total_files, :s3_bucket
attr_accessor :files