Skip to content

Instantly share code, notes, and snippets.

View darrenterhune's full-sized avatar

Darren Terhune darrenterhune

  • Canada
View GitHub Profile
@basti
basti / application.rb
Last active March 1, 2021 10:42 — forked from keighl/application.rb
Local Rails 4 assets precompilation using Capistrano 3 and rsync
# Speed things up by not loading Rails env
config.assets.initialize_on_precompile = false
@kirillzubovsky
kirillzubovsky / How to delete all tweets with Ruby fast
Last active July 4, 2023 07:39
A quick way to delete all your tweets using Twitter archive and a ruby script.
require 'twitter'
require "json"
USERNAME = 'YOUR_TWITTER_USER_NAME'
ARCHIVE_PATH = 'archive/data/js/tweets'
client = Twitter::REST::Client.new do |config|
config.consumer_key = 'TWITTER_APP_API_KEY'
config.consumer_secret = 'TWITTER_APP_API_SECRET'
config.access_token = 'TWITTER_APP_ACCESS_TOKEN'
@tedgrubb
tedgrubb / ttransparency.rb
Last active May 4, 2017 17:33
Paperclip Processor that finds the background color and replaces it with a transparent background. Also simulates anti-aliasing using '-fuzz' to get rid of pixelated artifacts.
# lib/paperclip_processors/transparency.rb
module Paperclip
class Transparency < Thumbnail
# Find the background and replace with transparency.
# -fuzz 20% simulates antialiasing
CONVERT_OPTIONS = [
'-alpha', 'set',
'-fill', 'white',
'-draw', "'color 0,0 replace'",
@kouheiszk
kouheiszk / _form.html.erb
Created September 11, 2015 04:34
simple_form.rb for semantic ui
<%= f.input :email,
wrapper: :semantic_icon_input,
label: false,
required: true,
placeholder: t('users.form.placeholder.email'),
left_icon: 'user' %>
@jfmengels
jfmengels / lodash-fp-documentation.md
Last active February 6, 2024 20:57
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs
@stevenharman
stevenharman / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Last active March 11, 2024 04:11
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

# This is a workaround for the rails issue described in
# https://github.com/rails/rails/issues/17368. If you use this,
# make sure you understand its code and what it does and what it
# doesn't.
#
# See below for an example.
# lib/lazy_ids.rb (i.e.)
module LazyIds
extend ActiveSupport::Concern
@amiantos
amiantos / index.js
Last active April 26, 2024 21:09
Zip Multiple Files from S3 using AWS Lambda Function
// Lambda S3 Zipper
// http://amiantos.net/zip-multiple-files-on-aws-s3/
//
// Accepts a bundle of data in the format...
// {
// "bucket": "your-bucket",
// "destination_key": "zips/test.zip",
// "files": [
// {
// "uri": "...", (options: S3 file key or URL)