This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parse out 404's and count them with `head` | |
grep '" 404' website.apachestyle.log* | cut -d'"' -f2 | sort | uniq -c | sort -nr | head | |
# Remove `head` to get all results | |
grep '" 404' website.apachestyle.log* | cut -d'"' -f2 | sort | uniq -c | sort -nr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### iTerm ### | |
# See https://www.iterm2.com/3.3/documentation-scripting-fundamentals.html | |
function iterm2_print_user_vars() { | |
iterm2_set_user_var phpVersion $(php -v | awk '/^PHP/ { print $2 }') | |
iterm2_set_user_var rubyVersion $(ruby -v | awk '{ print $2 }') | |
iterm2_set_user_var nodeVersion $(node -v) | |
} | |
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90 | |
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6 | |
namespace :db do | |
desc 'Dumps the database to backups' | |
task dump: :environment do | |
dump_fmt = ensure_format(ENV['format']) | |
dump_sfx = suffix_for_format(dump_fmt) | |
backup_dir = backup_directory(Rails.env, create: true) | |
full_path = nil | |
cmd = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This was used for a Rails app with PostgreSQL database on Heroku. | |
# It uses the DATABASE_URL as the source and destination. | |
# | |
# Usage: | |
# | |
# 1) Specify the SRC_APP, DEST_APP and THREADS variables in this script. | |
# 2) Run: `sh heroku_db_sync_prod_to_staging.sh` | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# parse date/time in detected time zone | |
time_zone_name = params[:time_zone] | |
time_zone = ActiveSupport::TimeZone.new(time_zone_name || Time.zone.name) | |
time_string = "#{params[:date]} #{params[:time]}" | |
time_in_time_zone = time_zone.parse time_string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Membership | |
###### SCOPES ###### | |
scope :active, where(:is_active => true) | |
scope :not_active, where{is_active != true} | |
scope :removed, where(:is_active => false, :unsubscribed_at => nil) | |
scope :unsubscribed, where{(is_active == false) & (unsubscribed_at != nil)} | |
scope :admin, active.where(:is_admin => true) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### CUSTOM CLASS WITH MAILERS TO PREVIEW ### | |
class EmailPreviews < MailerPreview::Engine | |
mailer NotificationMailer do | |
# specify a block that returns the arguments used for this mailer | |
preview(:new_follower) { User.last } | |
# make sure I didn't miss any email templates for this mailer | |
assert_full_coverage! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodes": [ | |
{ | |
"title": "Postmark Outbound", | |
"icon": "images/icons/postmark_64.png", | |
"top": 93, | |
"left": 357, | |
"compID": "postmark_send", | |
"from": "[email protected]", | |
"id": "step_129" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'active_support/core_ext' | |
require "base64" | |
get '/upload' do | |
bucket = 'bucket name here' | |
access_key_id = 'access key id here' | |
secret_access_key = 'Enter secret access key here' |