Minimum AWS IAM inline policy permissions for Thoughtbot Paperclip and AWS S3:
- s3:GetObject
- s3:PutObject
- s3:GetObjectAcl
- s3:PutObjectAcl
- s3:ListMultipartUploadParts
- s3:AbortMultipartUpload
- s3:ListBucket
- s3:ListBucketMultipartUploads
| #!/usr/bin/ruby | |
| # This is a quick skeleton of how to read a Wave file in ruby using the BinData gem. | |
| # There are many different chunk types and bit depths that should be accounted for! | |
| require 'rubygems' | |
| require 'bindata' | |
| class Wave < BinData::Record | |
| endian :little |
Minimum AWS IAM inline policy permissions for Thoughtbot Paperclip and AWS S3:
| <div class="article"> | |
| <h1 class="article-title"> | |
| {{ article.title }} | |
| </h1> | |
| <div class="article-body"> | |
| {{ article.content | replace: "<h3>", "<h4>", | replace: "<h2>", "<h3>" | replace: "<h1>", "<h2>" }} | |
| </div> | |
| </div> |
| def prevent_ugly_wrap(string) | |
| string.reverse.sub(" ", " ".reverse).reverse.html_safe | |
| end |
| require "securerandom" | |
| uuid = SecureRandom.uuid | |
| IO.popen("pbcopy", "w") { |f| f << uuid } | |
| puts uuid |
| #!/usr/bin/env sh | |
| # Add your favourite suspect folders. Run every now and then. | |
| folders=( | |
| /Library/Frameworks | |
| /Library/LaunchAgents | |
| /Library/LaunchDaemons | |
| /Library/Security/SecurityAgentPlugins | |
| ~/Library/LaunchAgents | |
| ) |
| import Foundation | |
| /// Registers how many times an app has been launched, using UserDefaults as storage. | |
| class LaunchCounter { | |
| private var defaults: UserDefaults | |
| private var defaultsKey = "launchCount" | |
| /// Initialise, optionally with a custom UserDefaults instance | |
| init(defaults: UserDefaults = .standard) { |
| body { | |
| font-family: ".AppleSystemUIFontRounded-Regular"; | |
| } |
| xml.instruct! | |
| xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do | |
| sitemap.resources.select { |page| page.destination_path =~ /\.html/ && page.data.noindex != true }.each do |page| | |
| xml.url do | |
| modified = page.data.date ? page.data.date.to_time : Time.now | |
| xml.loc URI.join(data.site.host, page.destination_path.chomp("index.html").chomp(".html")) | |
| xml.lastmod modified.iso8601 | |
| xml.changefreq page.data.changefreq || "monthly" | |
| xml.priority page.data.priority || "0.5" | |
| end |
| xml.instruct! :xml, version: "1.0" | |
| rss_attributes = { | |
| "version" => "2.0", | |
| "xmlns:dc" => "http://purl.org/dc/elements/1.1/", | |
| "xmlns:sy" => "http://purl.org/rss/1.0/modules/syndication/", | |
| "xmlns:atom" => "http://www.w3.org/2005/Atom", | |
| "xmlns:rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", | |
| "xmlns:content" => "http://purl.org/rss/1.0/modules/content/", | |
| "xmlns:itunes" => "http://www.itunes.com/dtds/podcast-1.0.dtd", |