- Go to terminal and create the icon file :
gedit ~/.local/share/applications/xampp-control-panel.desktop
- Add the following to it :
[Desktop Entry]
require 'aws-sdk' | |
class BucketSyncService | |
attr_reader :from_bucket, :to_bucket, :logger | |
attr_accessor :debug | |
DEFAULT_ACL = "public-read" | |
def initialize(from_bucket, to_bucket) |
class CustomScrubber < Loofah::Scrubber | |
ALLOWED_IFRAME_ATTRS = %w[allowfullscreen frameborder height src width].freeze | |
ALLOWED_VIDEO_REGEX = %r{\A(?:https?:)?//(?:www\.)?youtube|vimeo(?:-nocookie)?\.com/} | |
def scrub(node) | |
if node.name == 'iframe' && node['src'] =~ ALLOWED_VIDEO_REGEX | |
node.attribute_nodes.each { |a| a.remove unless ALLOWED_IFRAME_ATTRS.include?(a.name) } | |
return CONTINUE | |
end | |
return CONTINUE if html5lib_sanitize(node) == CONTINUE |
after "deploy:symlink", "deploy:restart_workers" | |
## | |
# Rake helper task. | |
# http://pastie.org/255489 | |
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
def run_remote_rake(rake_cmd) | |
rake_args = ENV['RAKE_ARGS'].to_s.split(',') | |
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}" |
rm -rf .git | |
rm -rf .gitkeep |
gedit ~/.local/share/applications/xampp-control-panel.desktop
[Desktop Entry]
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 20px; } | |
@media (min-width: 768px){ | |
body{ padding-top: 150px; } | |
} | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; max-width: 650px; margin: 0 auto; } |
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
# Please refer to http://ctoinsights.wordpress.com/2011/10/17/running-distributed-cron-jobs-in-the-cloud/ | |
class DatabaseSemaphore < ActiveRecord::Base | |
validates_presence_of :name, :message => "can't be blank" | |
def self.open?(name, lock_duration = 600) | |
# only one requestor can get open semaphore at a time | |
# sempahore can be locked in a closed position for lock_duration in seconds | |
semaphore_open = false | |
now = Time.now | |
# insert record if it does not exist yet |
1. Change rails version in Gemfile | |
> gem 'rails', '~> 5.1', '>= 5.1.4' | |
2. Remove Gemfile.lock | |
> git rm Gemfile.lock | |
3. Run bundle install command | |
> bundle install --jobs=5 | |
4. Run rails' app update to apply changes to app |
<input> with attribute required
This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
How to show a spinner only when the required validations pass? (Without using any validation plugin, only the required attribute).
Form with a required input
= form_for @person, remote: true do |f|
= f.text_field, :first_name, required: true