WordPress plugin that replaces http: with https: in any content containing the home URL wherever found in content requested via https.
https://gist.github.com/curt/e867346acb33a1d24c8fc1e79f416e37
class URI::Generic | |
def query_params | |
Hash[(query || '').split('&').collect{ |a| a.split('=') }.collect{ |b| [URI.unescape(b[0]), b[1].nil? ? nil : URI.unescape(b[1])] }] | |
end | |
alias_method :query_parameters, :query_params | |
end |
module RandomAttributes | |
def self.included(controller) | |
controller.send :extend, ClassMethods | |
controller.send :include, InstanceMethods | |
end | |
module ClassMethods | |
def random_attribute(attr_sym, key_length = 10) | |
cattr_accessor :random_attributes | |
validates_presence_of attr_sym |
module Minion | |
def enqueue_or_log(key, args) | |
enqueue(key, args) | |
rescue | |
Rails.logger.error "Unable to enqueue '#{key}' with args '#{args.inspect}': #{$!}" if Rails.logger | |
end | |
end |
#!/usr/bin/env ruby | |
# | |
# Usage: ruby background_control.rb [start|stop|restart] | |
# | |
require 'rubygems' | |
require 'daemons' | |
background_file = File.join(File.dirname(__FILE__), 'lib', 'background.rb') |
check process app_background | |
with pidfile "/path/to/app/shared/pids/background.pid" | |
start program = "/usr/bin/sudo -u user RAILS_ENV=production /usr/local/bin/ruby /path/to/app/current/background_control.rb start" | |
stop program = "/usr/bin/sudo -u user RAILS_ENV=production /usr/local/bin/ruby /path/to/app/current/background_control.rb stop" |
1 * * * * /usr/local/bin/rake -f /path/to/app/current/Rakefile RAILS_ENV=production schedules:hourly |
namespace :background do | |
task :restart do | |
run "[ -f #{shared_path}/pids/background.pid ] && kill `cat #{shared_path}/pids/background.pid`" | |
sudo "monit start app_background" | |
end | |
end | |
after "deploy", "background:restart" |
require 'tmail' | |
def email_valid?(email) | |
TMail::Address.parse(email) | |
rescue TMail::SyntaxError | |
false | |
else | |
true | |
end |
WordPress plugin that replaces http: with https: in any content containing the home URL wherever found in content requested via https.
https://gist.github.com/curt/e867346acb33a1d24c8fc1e79f416e37
wget --no-check-certificate https://wordpress.org/latest.tar.gz | |
ln -s blog wordpress | |
tar -xzvf latest.tar.gz | |
unlink wordpress |