Spc z f +
Increase font size, press + until desired size, q
for exit menu
Spc z f -
Increase font size, press - until desired size, q
for exit menu
Spc p f
Search file by name in current project
Spc f s
Save current buffer
Spc f S
Save all buffers
Spc f t
NerdTree toggle
R
On NerdTree, sets higlighted directory as Root
The Model layer should also contain the business logic of your application.
Class: A class defines the characteristics of an object, including the details of what it is (its attributes) and what it can do (its methods).
Method: A method exists on a class and defines what the class can do.
Encapsulation: Ideally, the code for a class should be relatively self-contained through encapsulation, which is the concealment of functional details of a class from the other objects that call its methods. This is typically done by limiting the methods other objects are allowed to call and exposing a public interface through which an object is exposed to the world. In Ruby, this is done with the public, protected, and private keywords.
# config/application.rb | |
# Fix for Please add devise :omniauthable | |
initializer 'main_app.auto_load' do |app| | |
Rails.application.reloader.to_run(:before) do | |
Rails.application.reloader.prepare! | |
end | |
end |
When attenpting to install a Linux Distro, its common to download the ISO then use a tool (e.g. UNetbootin, Linux Live USB Creator, Universal USB Installer, Live USB Creator) to make a USB bootable with the installer of the distro. This is no the recommended way.
https://wiki.archlinux.org/index.php/USB_flash_installation_media
To list USB devices
# db/migrate/20170315153444_create_spree_state_translations.rb | |
class CreateSpreeStateTranslations < ActiveRecord::Migration[5.0] | |
reversible do |dir| | |
dir.up do | |
Spree::State.create_translation_table! name: :string, abbr: :string | |
end | |
dir.down do | |
Spree::State.drop_translation_table! | |
end |
Gem for searches using Postgresql.
Uses a dictionary to know the synonyms.
Query to get all currently available dictionaries
SELECT dictname FROM pg_catalog.pg_ts_dict; # or \dF
Query to get current default configuration
Block requests with matching header
class Rack::Attack
throttle('req/ip', limit: 0, period: 1.second) do |req|
req.ip if req.env['HTTP_X_SCANNER'] == 'Netsparker' ||
req.params['email'] == '[email protected]'
end
end
#Solidus
Install imagemagick for thumbnail generation
brew install imagemagick
Create a new rails app
rails new solidus -d postgresql