This post shows how to make sitemap.xml for your web site. The sitemap will be accessible by URL http://mysite.com/sitemap.xml
Myrails::Application.routes.draw do| <!-- Modified from https://gist.github.com/NicholasKimuli/2b167ca1c6ce03cb860e3f89d17db1eb | |
| Bonaire, Saba and Sint Eustatius may need a future flag update --> | |
| <select class="input-block-level" id="countryCode" name="countryCode"> | |
| <option data-countryCode="AF" value="93">🇦🇫 Afghanistan (+93)</option> | |
| <option data-countryCode="AL" value="355">🇦🇽 Albania (+355)</option> | |
| <option data-countryCode="DZ" value="213">🇩🇿 Algeria (+213)</option> | |
| <option data-countryCode="AD" value="376">🇦🇩 Andorra (+376)</option> | |
| <option data-countryCode="AO" value="244">🇦🇴 Angola (+244)</option> | |
| <option data-countryCode="AI" value="1264">🇦🇮 Anguilla (+1264)</option> | |
| <option data-countryCode="AG" value="1268">🇦🇬 Antigua & Barbuda (+1268)</option> |
This post shows how to make sitemap.xml for your web site. The sitemap will be accessible by URL http://mysite.com/sitemap.xml
Myrails::Application.routes.draw do| class ApplicationController < ActionController::Base | |
| private | |
| # Runs a rake task asyncronously in a child process | |
| # | |
| # for example, in any controller: | |
| # async_rake("async:import_fixtures") | |
| # async_rake("db:maintenance:cleanup", table: "things", ids: [12, 114, 539]) | |
| # |
| ########## | |
| # Tweaked Win10 Initial Setup Script | |
| # Primary Author: Disassembler <[email protected]> | |
| # Modified by: alirobe <[email protected]> based on my personal preferences. | |
| # Version: 2.20.2, 2018-09-14 | |
| # Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script | |
| # Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/ | |
| # Tweak difference: | |
| # | |
| # @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ... |
| class ChangeProductLongDescription < ActiveRecord::Migration | |
| def up | |
| # simple and straightforward | |
| change_column :products, :long_description, :text | |
| end | |
| # but why cant it just be: | |
| # change_column :product, :long_description, :string | |
| # ??? | |
| # because effin databases don't like you, that's why. |
Rails 4 is out featuring Russian Doll caching (AKA Cache Digests). In this article, I apply Russian Doll caching to one of my poorer performing Rails 3 pages using the cache_digests gem.
ActionView templates are great. They are easy to code, manage and extend but the one thing they are not is fast...at least not out of the box.
In this article, I'll be using AppNeta's TraceView to time ActionView performance. If you haven't used TraceView before, checkout my previous article Instrumenting Ruby on Rails with TraceView.
ActionView puts forth a great development pattern of views and partials that is easy to understand, implement and maintain but that comes at a cost: The rendering process is complex and slow.
| #!/bin/bash | |
| set -e | |
| echo "> Removing certificate" | |
| sudo security delete-certificate -c localhost || true | |
| echo "> Generating .key" | |
| sudo openssl genrsa -out config/localhost.key 4096 |
| <?php | |
| $countries = | |
| array( | |
| "AF" => "Afghanistan", | |
| "AL" => "Albania", | |
| "DZ" => "Algeria", | |
| "AS" => "American Samoa", | |
| "AD" => "Andorra", | |
| "AO" => "Angola", |
| <div class="form-group"> | |
| <%= form.label :type, "Type", class: "font-weight-bold" %> | |
| <%= form.select :type, ['TextQuestion', 'UrlQuestion'], { include_blank: true }, { class: "form-control", data: { action: "input->toggle#changed", target: "toggle.select" } } %> | |
| </div> | |
| <div class="form-group"> | |
| <%= form.label :name, "Name", class: "font-weight-bold" %> | |
| <%= form.text_field :name, class: "form-control" %> | |
| </div> | |
| <div class="form-group" data-target="toggle.element" data-values="UrlQuestion"> | |
| <%= form.label :url, "URL", class: "font-weight-bold" %> |
| // Source: https://twitter.com/calebporzio/status/1151876736931549185 | |
| <div class="flex"> | |
| <aside class="h-screen sticky top-0"> | |
| // Fixed Sidebar | |
| </aside> | |
| <main> | |
| // Content | |
| </main> |