This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://code.google.com/p/tsearch-polish/wiki/PolskiSlownikTsearchPostgreSQL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file is copied to spec/ when you run 'rails generate rspec:install' | |
| ENV["RAILS_ENV"] ||= 'test' | |
| require File.expand_path("../../config/environment", __FILE__) | |
| require 'rspec/rails' | |
| require 'rspec/autorun' | |
| require 'factory_girl_rails' | |
| require 'database_cleaner' | |
| require 'pry' | |
| include Warden::Test::Helpers | |
| Warden.test_mode! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #spec/features/features_helper.rb | |
| require_relative '../spec_helper' | |
| require 'capybara/rspec' | |
| require 'capybara-screenshot/rspec' | |
| require 'selenium-webdriver' | |
| require 'capybara/poltergeist' | |
| Capybara.javascript_driver = :poltergeist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Availability < ActiveRecord::Base | |
| has_many :availability_periods, dependent: :destroy, inverse_of: :availability | |
| accepts_nested_attributes_for :availability_periods, allow_destroy: true | |
| validates_associated :availability_periods | |
| validate :must_have_periods | |
| def must_have_periods | |
| if availability_periods.empty? or availability_periods.all? {|period| period.marked_for_destruction? } | |
| errors.add(self.property.name, I18n.t('models.availability.periods_required')) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| custom view | |
| #lib trzeba przeładowywać z każdą zmianą | |
| #dodatkowa akcja - maincontroller jest scope-em a nie akcja!! | |
| otworz main_controller , dodaj go do lib i w configu | |
| config.autoload_paths += ["#{Rails.root}/lib/rails_admin"] | |
| folder i bez / | |
| - chujnia ten sposob nie zadziała, rails admin przeładowuje na bieżąco main controller ipo oswiezeniu strony nie ma juz naszego nadpisanego kodu ://// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo add-apt-repository ppa:pitti/postgresql | |
| sudo apt-get update | |
| sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 | |
| https://wiki.postgresql.org/wiki/Apt | |
| sudo su -l postgres | |
| psql -d template1 -p 5433 | |
| CREATE EXTENSION IF NOT EXISTS hstore; | |
| CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #load all subdirectories of config/locales | |
| config.i18n.load_path += Dir[File.join(MY_ROOT, 'config', 'locales', '**', '*.{rb,yml}')] | |
| #validate locales | |
| config.i18n.enforce_available_locales = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config --global core.editor "vim" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c = TZInfo::Country.get('US') | |
| zones = c.zone_identifiers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String::endsWith = (suffix) -> | |
| @indexOf(suffix, @length - suffix.length) isnt -1 | |
| #Doesn't create a substring | |
| #Uses native indexOf function for fastest results | |
| #Skip unnecessary comparisons using the second parameter of indexOf to skip ahead | |
| #Works in Internet Explorer | |
| #NO Regex complications |