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
Redirect rules for Redirector: https://chrome.google.com/webstore/detail/redirector/pajiegeliagebegjdhebejdlknciafen | |
From To | |
^https?://(.*?)\.m\.wikipedia\.org/(.*) https://$1.wikipedia.org/$2 | |
^https?://mobile\.twitter\.com/(.*) https://twitter.com/$1 | |
^https?://amp\.reddit\.com/(.*) https://reddit.com/$1 |
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
# /etc/X11/Xwrapper.config | |
needs_root_rights = yes |
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
# config/deploy.rb | |
# Using Capistrano 3 | |
# Set the current environment for Whenever and avoid name collisions | |
set :whenever_environment, -> { fetch(:stage) } | |
set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" } | |
# config/schedule.rb | |
every "@reboot" do | |
# If the app is using Puma | |
command "cd #{path} && bundle exec puma -e #{@environment}" |
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
# Method to get the cover image URL for a YouTube video by its ID | |
# There are several cover images avaiable for every video, you can specify which one you need through the type parameter | |
# For a list of possible cover types see http://stackoverflow.com/a/2068371/3463845 | |
# The returned URL will be protocol-relative, so it should work on sides loaded through HTTP and HTTPS as well | |
def youtube_cover_for(id, type = :default) | |
"//img.youtube.com/vi/#{id}/#{type}.jpg" | |
end | |
# Method to extract the video ID from a YouTube embed code | |
# This very simple regex works by exploiting the fact that the YouTube video IDs are always 11 characters long |
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
# To fix 'command not found: bin/delayed_job' error on Capistrano deploy, execute this on the server | |
bundle exec rails generate delayed_job |
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
Show hidden characters
{ | |
"caret_extra_width": 1, | |
"caret_style": "phase", | |
"color_scheme": "Packages/Predawn Twilight Theme/Predawn Twilight.tmTheme", | |
"detect_indentation": false, | |
"draw_minimap_border": true, | |
"findreplace_small": true, | |
"font_size": 13, | |
"highlight_line": true, | |
"ignored_packages": |
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
# config/initializers/active_record_patch.rb | |
require 'active_record/connection_adapters/abstract_mysql_adapter' | |
module ActiveRecord | |
module ConnectionAdapters | |
class AbstractMysqlAdapter | |
NATIVE_DATABASE_TYPES[:string] = { name: "varchar", limit: 191 } | |
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
# /etc/apache2/users/user.conf | |
NameVirtualHost *:80 | |
<Directory "/path/to/rails/apps/"> | |
Options Indexes Multiviews Includes | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> |
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
# Capfile | |
require "whenever/capistrano" | |
# deploy.rb | |
set :whenever_environment, -> { fetch(:stage) } | |
set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" } | |
# schedule.rb | |
case @environment | |
when "staging" |
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
# dump | |
mysqldump -u user -p database --default-character-set=utf8mb4 --result-file=dump.sql | |
# restore | |
mysql -u user -p database < dump.sql |
NewerOlder