[ css ] transform and opacity

.showing .element {
 opacity: 0;
 transform: translateY(0);
}

.element {
 opacity: 0;
 transform: translateY(-100%);
transition: all 0.5s ease-in-out;
}

click to toggle  ​.showing

Advertisements

[ docker ] Docker installation for windows 7

Installation

download “Docker Toolbox” and install

  • When install, check the “VirtualBox” to install the bundle virtualbox.

If you have Virtual Box running, you must shut it down before running the installer.

ref : https://docs.docker.com/toolbox/toolbox_install_windows/

 

“Docker for Windows Installer” in windows 7 will not work

Error

C:/>"Docker for Windows Installer"

Unhandled Exception: System.Windows.Markup.XamlParseException: Set property 'Sys
tem.Windows.FrameworkElement.Style' threw an exception. ---> System.IO.FileNotFo
undException: Could not load file or assembly 'PresentationFramework.Aero2, Publ
icKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find
the file specified.

Solution

Use DockerToolBox instead

After Install 

Run the “Docker Quickstart Terminal”

docker_toolbox_windows_7

[ rails ] factoryGirl generates new object.id every `it`

describe '#test factoryGirl object' do

let!(:the_site) do
create(:site, user: current_user)
end
let(:whatever_parameters) do
{
image: 'favicon',
id: the_site.id
}
end

it 'test#1' do
p the_site.id .                     # 205

p whatever_parameter   # {image: 'favicon', id: 205}
end

it 'test#2' do
p the_site.id .                     # 206

p whatever_parameter   # {image: 'favicon', id: 206}
end

it 'test#3' do
p the_site.id .                     # 207

p whatever_parameter   # {image: 'favicon', id: 207}
end

end

[ rails ] redirect exception raised i.e. `ActiveRecord::RecordNotFound` to the 404 page on local development

By default, rails will redirect it on testing environment and production environment.

On the development environment, it will raise the error page instead of /404 page.

 

However, if we want to redirect on development, use the configuration below.

config/environments/development.rb

config.consider_all_requests_local = false

[ carrierwave ] process in background

model file

process_in_background :avatar

add to migration file : the flag identifies whether the processing is finished

add_column :users, :avatar_processing, :boolean, null: false, default: false

 then we will able to use favicon_processing? to return the right image when ready

In model

def favicon_url(version = nil)
return if favicon.url.blank?
url = favicon_processing? ? favicon.url : favicon.url(version)
"#{url % rand(4)}"
end

ref : https://github.com/lardawge/carrierwave_backgrounder