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
# Tell system when Xcode utilities live: | |
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
# Set "opendiff" as the default mergetool globally: | |
git config --global merge.tool opendiff |
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
/* | |
This overlay provides a 'liquid' mode to the excellent CodeMirror editor (http://codemirror.net/). | |
Add something like this to your CSS: | |
.cm-liquid-tag { | |
color: #32273f; | |
background: #ead9ff; | |
} | |
.cm-liquid-variable { |
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
window.AttachmentUtils = (function() { | |
var BASE64_MARKER = ';base64,'; | |
var Utils = { | |
// Takes a file size (in bytes) and returns a human-friendly string representation. | |
humanFileSize: function(size) { | |
if(size < 1) return "0 bytes"; | |
// http://stackoverflow.com/a/20732091 |
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
// Attach an event handler to when the modal is opened. | |
$(document).on($.modal.OPEN, function(event, modal) { | |
// Use setTimeout to close the modal in 5 seconds (5000 milliseconds). | |
setTimeout(function() { | |
$.modal.close(); | |
}, 5000); | |
}); |
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
/* | |
Distributed under The MIT License: | |
http://opensource.org/licenses/mit-license.php | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to |
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 AddRecordUuidToActiveStorageAttachments < ActiveRecord::Migration[5.2] | |
def change | |
# After applying this migration, you'll need to manually go through your | |
# attachments and populate the new `record_uuid` column. | |
# If you're unable to do this, you'll probably have to delete all your attachments. | |
# You've pretty much got useless garbage data if that's the case :( | |
add_column :active_storage_attachments, :record_uuid, :uuid | |
end | |
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
#!/usr/bin/env ruby | |
# | |
# Shotgun approach (read: slow and dirty hack) to help find unused helpers in a Rails application | |
# | |
start = Time.now | |
# Build an array of filename globs to process. | |
# Only search file types that might use or define a helper. | |
extensions = %w[rb js haml erb jbuilder].map { |ext| "app/**/**/*.#{ext}" } |
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
default_app_config = 'cn.apps.users.config.UsersAppConfig' |
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
# !/usr/bin/env bash | |
# File path should be ./bin/post_compile | |
# (.sh extension added in Gist just to enable shell syntax highlighting. | |
# https://discussion.heroku.com/t/django-automaticlly-run-syncdb-and-migrations-after-heroku-deploy-with-a-buildpack-or-otherwise/466/7 | |
echo "=> Performing database migrations..." | |
python manage.py migrate |
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
shared_context 'sign in after confirmation' do |resource_name:| | |
before do | |
@request.env['devise.mapping'] = Devise.mappings[resource_name] | |
end | |
shared_examples 'failed confirmation' do |error:| | |
it { is_expected.to have_http_status :ok } | |
it { is_expected.to render_template 'devise/confirmations/new' } | |
it "has errors on @#{resource_name}" do |
NewerOlder