Javascript with Turbolinks in Rails 4
If some of your scripts don't work with turbolinks, you should do the following:
ready = ->
#your code here
$(document).ready(ready)
$(document).on('page:load', ready)
Related cards:
Rspec + Capybara + Rails4 + Spork (intergation tests setup with selenium and poltergeist)
Add in Gemfile:
group :development, :test do
gem 'rspec-rails'
gem 'spork-rails'
end
group :test do
gem 'capybara'
gem 'database_cleaner'
gem 'email_spec'
gem 'poltergeist'
gem 'launchy'
gem 'selenium-webdriver'
end
Run ...
Rails migration add float point field with scale and precision
class CreateFakes < ActiveRecord::Migration
def change
create_table :fakes do |t|
t.decimal :float_value, :precision => 4, :scale => 3
end
end
end
This will allow you to have 3 digits after the decimal point and 4 digits ...
Install gems without those which in production group
For that purpose, just use these command:
bundle install --without production
Setting up Javascript environment with NVM on Ubuntu 14.04
NVM provides you more convenient way to manage and set up your Javascript(Node.js) environment.
First install NVM, note git
must be installed on your sistem:
^
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git check...
ubuntu nginx with txid module
To install nginx with txid module
install nginx-full package:
sudo apt-get install nginx-full
download last nginx source:
wget http://nginx.org/download/nginx-1.9.9.tar.gz
examine what ...
Deploy rails apps with capistrano
Install capistrano:
add to Gemfile
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
end
Then cd to project root folder and run:
bundle install
capify .
setup your config/deploy.rb
file, [here some u...
Ubuntu 12.04 Java install
First install python-software-properties
:
sudo apt-get install python-software-properties
Next, remove openjdk
package if installed:
sudo apt-get remove openjdk*
Now, add java repository by webupd8team:
sudo add-apt-reposito...
`ls` files in directory ordered by modification time
To do this you should type:
ls --full-time -t
The output will be similar to this:
drwxr-xr-x 2 konjoot konjoot 4096 2016-02-06 17:28:20.915296664 +0300 temp
drwxr-xr-x 40 konjoot konjoot 20480 2015-12-22 22:13:37.444222190 +0300...
Ubuntu postgresql 9.3 installation for RoR
Add repository and install Postgresql:
^
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
^
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sud...