Skip to content

Instantly share code, notes, and snippets.

View darrenterhune's full-sized avatar

Darren Terhune darrenterhune

  • Canada
View GitHub Profile
@amiantos
amiantos / index.js
Last active April 3, 2024 07:10
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)
@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
@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
@toobulkeh
toobulkeh / deploy.rb
Created January 2, 2014 02:42 — forked from benedikt/rails.rb
Updated for Capistrano 3.
# encoding: UTF-8
# Place in config/deploy.rb
namespace :rails do
desc "Open the rails console on each of the remote servers"
task :console do
on roles(:app) do |host| #does it for each host, bad.
rails_env = fetch(:stage)
execute_interactively "ruby #{current_path}/script/rails console #{rails_env}"
@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' %>
@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'
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@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
Status Code Status Message Symbol
1xx Informational
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing
2xx Success
200 OK :ok
201 Created :created
202 Accepted :accepted