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
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 |
body { | |
font-family: ".AppleSystemUIFontRounded-Regular"; | |
} |
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) { |
#!/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 | |
) |
require "securerandom" | |
uuid = SecureRandom.uuid | |
IO.popen("pbcopy", "w") { |f| f << uuid } | |
puts uuid |
def prevent_ugly_wrap(string) | |
string.reverse.sub(" ", " ".reverse).reverse.html_safe | |
end |
<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> |
Minimum AWS IAM inline policy permissions for Thoughtbot Paperclip and AWS S3:
#!/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 |