Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@hopsoft
hopsoft / prefetch.js
Last active December 27, 2023 02:45
Turbolinks Prefetching
const hoverTime = 400
const fetchers = {}
const doc = document.implementation.createHTMLDocument('prefetch')
function fetchPage (url, success) {
const xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.setRequestHeader('VND.PREFETCH', 'true')
xhr.setRequestHeader('Accept', 'text/html')
xhr.onreadystatechange = () => {
@belgoros
belgoros / AWS S3-Paperclip5-Heroku.md
Created November 3, 2016 21:43
Setup Rails app with Paperclip 5, Amazon S3 and Heroku

Setting Amazon S3 for Paperclip and Heroku

The latest Paperclip release 5.1.0 has changed a little bit the way to set it up with Amazon S3 service (Amazon Simple Storage Service). Moreover, after googling a lot here and there, we could see many solutions and settings, some of them being outdated, some - often different and did not work well. So I decided to summarize in one replace all the steps needed to set up your Rails application deployed on Heroku and be able to use it with Paperclip 5 and Amazon S3 service.

In case you don't know, Heroku does not allow your Rails application to write and offers read only access. What means that you can't use Paperclip and save your files to Heroku's file system.

So you will have to find a way to upload/store/read your files. As stated in Paperclip documentation, Paperclip ships with 3 storage adapters:

@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active November 7, 2022 09:11
Diagrams for Documentation

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

@azu
azu / git-issue.zsh
Last active October 29, 2016 15:18
git-issue + git-flow + percol
# percol + git issue
function found_command { which $1 &> /dev/null }
function is_issued() {
ISSUE_TYPE=$(git config issue.type 2>/dev/null)
if [ "$ISSUE_TYPE" != "" ]; then
return 0
else
return 1
fi
}
envy17:wonky david$ ls -laR vendor/gems/
total 24
drwxr-xr-x 8 david staff 272 Jan 4 15:34 .
drwxr-xr-x 4 david staff 136 Jan 4 15:33 ..
drwxr-xr-x 12 david staff 408 Jan 4 15:34 cache
drwxr-xr-x 3 david staff 102 Jan 4 15:33 dirs
drwxr-xr-x 2 david staff 68 Jan 4 15:34 doc
-rw-r--r-- 1 david staff 8321 Jan 4 15:34 environment.rb
drwxr-xr-x 20 david staff 680 Jan 4 15:34 gems
drwxr-xr-x 20 david staff 680 Jan 4 15:34 specifications