So you want to have pretty URLs with no trailing slash or .html like:
http://mysite.com/blog/my-new-kitten
not like:
http://mysite.com/blog/my-new-kitten/
or
| # I used https://github.com/eliotsykes/rack-zippy to serve gzipped static assets. | |
| # By default the rails asset pipeline was not compressing any static svg files, | |
| # so I did the following to achive that. | |
| # | |
| # First create a rake task that will fine and compress svg files. | |
| # File: lib/tasks/assets_svg_compress.rake | |
| namespace :assets do | |
| task :svg_compress => :environment do | |
| svg_files = Dir["./public/**/*.svg"] | |
| svg_files.each do |file| |
So you want to have pretty URLs with no trailing slash or .html like:
http://mysite.com/blog/my-new-kitten
not like:
http://mysite.com/blog/my-new-kitten/
or
| # === EDITOR === | |
| Pry.editor = 'vi' | |
| require 'awesome_print' | |
| # == Pry-Nav - Using pry as a debugger == | |
| Pry.commands.alias_command 'c', 'continue' rescue nil | |
| Pry.commands.alias_command 's', 'step' rescue nil | |
| Pry.commands.alias_command 'n', 'next' rescue nil | |
| # === CUSTOM PROMPT === |
| .super-fly-list-component .measure { | |
| position: absolute; | |
| left: -9999px; | |
| } | |
| .super-fly-list-component { | |
| position: relative; | |
| } | |
| .super-fly-list-component li { | |
| position: absolute; | |
| transition: opacity .3s ease, transform .3s ease, top .1s ease; |
| // set svg d path used as fallback (star) | |
| $svg-d-path: 'm25,1l6,17l18,0l-14,11l5,17l-15,-10l-15,10l5,-17l-14,-11l18,0l6,-17z' !default; | |
| // functions to urlencode the svg string | |
| @function str-replace($string, $search, $replace: '') { | |
| $index: str-index($string, $search); | |
| @if $index { | |
| @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); | |
| } | |
| @return $string; |
| require "open-uri" | |
| require "net/http" | |
| Error = Class.new(StandardError) | |
| DOWNLOAD_ERRORS = [ | |
| SocketError, | |
| OpenURI::HTTPError, | |
| RuntimeError, | |
| URI::InvalidURIError, |
gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.bundleRAILS_ENV=production rake db:create db:migrate db:seedrake secret and copy the outputexport SECRET_KEY_BASE=output-of-rake-secretrake assets:precompile. This will create a folder public/assets that contains all of your assets.RAILS_ENV=production rails s and you should see your app.Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.
| //does not work with colors containing alpha | |
| @function encodecolor($string) { | |
| @if type-of($string) == 'color' { | |
| $hex: str-slice(ie-hex-str($string), 4); | |
| $string:unquote("#{$hex}"); | |
| } | |
| $string: '%23' + $string; | |
| @return $string; | |
| } |