Skip to content

Instantly share code, notes, and snippets.

View kevinhq's full-sized avatar
💭
I may be slow to respond.

kevin kevinhq

💭
I may be slow to respond.
View GitHub Profile
@kevinhq
kevinhq / README.md
Created April 25, 2020 11:20 — forked from soxofaan/README.md
Simple pretty CSV and TSV file viewer.
@kevinhq
kevinhq / migrate_paperclip_to_s3.rake
Created April 21, 2020 11:36 — forked from awd/migrate_paperclip_to_s3.rake
Migrate local paperclip assets to Amazon S3.
##
# Use this behind the scenes to migrate files from your filesystem to Amazon S3
# %: rake paperclip_migration:migrate_to_s3
##
namespace :attachments do
desc "migrate files from filesystem to s3"
task :migrate_to_s3 => :environment do
require 'aws/s3'
@kevinhq
kevinhq / migrate_paperclip_to_s3.rake
Created April 21, 2020 11:35 — forked from awd/migrate_paperclip_to_s3.rake
Migrate local paperclip assets to Amazon S3.
##
# Use this behind the scenes to migrate files from your filesystem to Amazon S3
# %: rake paperclip_migration:migrate_to_s3
##
namespace :attachments do
desc "migrate files from filesystem to s3"
task :migrate_to_s3 => :environment do
require 'aws/s3'
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", "6.0.2.2"
gem "sqlite3"
@kevinhq
kevinhq / minimal-analytics-snippet.js
Created December 21, 2018 09:29 — forked from DavidKuennen/minimal-analytics-snippet.js
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@kevinhq
kevinhq / has_many_through_with_includes_inside_scope_rails4.rb
Last active June 7, 2018 15:29
Confirm Rails 4 behavior for includes inside has_many scope
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.2.10'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@kevinhq
kevinhq / has_many_through_with_includes_inside_scope.rb
Last active June 7, 2018 15:30
Confirm Rails 5.1.6 behavior for includes inside has_many scope
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '5.1.6'
gem 'sqlite3'
GEMFILE
system 'bundle'
end