Skip to content

Instantly share code, notes, and snippets.

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@yusupova
yusupova / rails-puma.service
Created January 28, 2017 12:27
systemd service to start your Rails app with Puma
# /etc/systemd/system/rails-puma.service
# rvm wrapper default systemd rails
# systemctl enable rails-puma
# systemctl start rails-puma
[Unit]
Description=Rails Puma Webserver
Wants=network-online.target
After=network.target network-online.target
@joekur
joekur / html_safe.md
Last active February 4, 2025 18:35
Proper Use of `html_safe`

Proper use of html_safe

Let's look at an innocuous piece of ruby. Consider some view code showing a user's name and phone number:

"#{first_name} #{last_name} #{phone}"

Great - this is very succinct, readable, and can easily be extracted to a method in a

@joekur
joekur / security_notes.md
Created May 22, 2014 17:00
Security notes for Rails

STAY SAFE!

SQL Injection

Never interpolate user input directly in a SQL statement.

Don't:

User.where("name = #{params[:search][:name]}")
@danielestevez
danielestevez / gist:2044589
Last active April 13, 2025 23:35
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}