...entered the unmistakeable file extension like material_orders_controller.rb, this may help you: Causing the Problem Sometimes you create a new file and forget to enter the ending like material_orders_controller...
...Rubymine handles such files per default as simple txt files. You delete this file and create a new one with correct ending: material_orders_controller.rb. But still Rubymine treats this file as...
...look like this: # Begin Whenever generated tasks for: project100 MAILTO="log@example.com" MAILFROM="cron@example.com" # When server is booting up, ensure Sidekiq is running @reboot start_sidekiq 23 8 * * * baz 30 * * * * plop...
...generated tasks for: project100 While you can human-parse this one easily, crontabs with several lines are hard to read. The following command will ignore any comments or environment variables...
The following snippet demonstrates how you could create excel files (with spreadsheet gem) and format columns so that they follow a specific number format like currencies or dates do.
require 'spreadsheet' Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => 'test' money_format = Spreadsheet::Format.new :number_format => "#,##0.00 [$€-407]" date_format = Spreadsheet::Format.new :number_format => 'DD.MM.YYYY...
Isolate scopes offer three kinds of variable binding. One of them is &, allowing to bind a property of the isolate scope to a function in the parent scope. Example:
@app.directive 'panel', -> scope: parentFn: '&proxy' link: (scope) -> scope.parentFn(arg1: 'first', arg2: 'second') In this dumb example, the panel directive will call its scope's parentFn() function with two arguments...
...the details container: {{ content }} ngClass will be taking care of updating the details container's slide-index-N class; e.g. when the currentSlideIndex changes from 4 to 5, the slide...
...index-4 class is being removed and the slide-index-5 class is being added. CSS With ngAnimate included, ngClass will add certain animation classes. In the above example, it...
...when you try to run puppet agent: Error: Failed to apply catalog: undefined method `strip' for nil:NilClass you could have a very bad time debugging it. Because there will...
Info: Applying configuration version '1558534846' Error: Failed to apply catalog: undefined method `strip' for nil:NilClass /usr/local/lib/ruby/site_ruby/2.4/puppet/provider/mailalias/aliases.rb:28:in `process' /usr/local/lib/ruby/site_ruby/2.4/puppet/util/fileparsing.rb:152:in `handle_record_line' /usr/local/lib/ruby/site_ruby/2.4/puppet/util/fileparsing.rb...
...Rails 3.2, Rails 4.2 and Rails 5.0. Basic Usage Our example will be a simple address book: class Contact < ActiveRecord::Base validates_presence_of :name, :street, :city, :email end
...create a new class ContactFilter that will describe the searchable columns: class ContactFilter include Minidusen::Filter filter :text do |scope, phrases| columns = [:name, :email] scope.where_like(columns => phrases) end
ImageMagick can automatically crop surrounding transparent pixels from an image: convert input.png -trim +repage output.png You need to +repage to update the image's canvas, or applications will...
...be randomly confused. Trimming specific colors is also possible, see the documentation. Resizing into a box Occasionally, you want to resize an image to a maximum width or height, and...
SudoSlider is a simple yet powerful content slider that makes no (or very few) assumptions about your markup and is very customizable. You can basically embed any HTML into the...
...slides, so you can mix images, videos, texts, and other stuff. Check out the demos. Please note: There is a ton to configure. Check the demos and read the docs...
If you save a non-standard object (not a String or Fixnum, etc) like the AwesomeClass from your application in the session of visitors be prepared that some time you...
...will get this exception: ActionController::SessionRestoreError: Session contains objects whose class definition isn't available. Remember to require the classes for all objects kept in the session. (Original exception: ...)
...or if none given, by it's number: When /^(.*?) inside the (.*?). iframe$/ do |nested_step, frame_number| page.within_frame(frame_number.to_i) do step nested_step end end When /^(.*?) inside the...
...iframe:$/ do |nested_step, frame_number, table_or_string| page.within_frame(frame_number.to_i) do step("#{nested_step}:", table_or_string) end end Use it like this: Then the radio button...
Sometimes your code has long lines: describe 'foo' do describe 'bar' do really_long_line_really_long_line_really_long_line another_line When you're working with multiple editor...
...really_long_line_really_long_| another_line | To help with this you can activate Soft wraps in the RubyMine options under General → Editor . Your code will now look like this...
...it might be unavoidable to have different CSS rules for Internet Explorer than for sane browsers. Using Sass, this can be achieved in a relatively non-hackish way without CSS...
Step 1 Move your current Sass file into a partial. Let's assume it was called screen.sass. Rename it _screen.sass. Step 2 Create two new Sass files:
If your requests blow up in Ruby or CURL, the server you're connecting to might only support requests with older SSL/TLS versions. You might get an error like: OpenSSL...
...SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=unknown state SSL Server Test This SSL Server Test can help finding out which SSL/TLS versions the server can handle...
The way MySQL's FULLTEXT tokenizer splits text into word tokens might not always be what you need. E.g. it splits a word at period characters. Since the tokenizer has...
...near-zero configuration options (minimum word length and stopwords list), you need to hack it. There are three options available. Option 1: If you like pain Write a Full-Text...
...id attributes for fields again. This card presents you with a way to call something like - form_for @user, :prefix => 'overlay' do |form| = form.text_field :email and get this as...
...we would not want to pass an overlay_user[email] param to the controller. Setting :id explicitly will not be affected by the prefix. First, have your FormBuilder keep the...
...but keep the database itself), you have two options. Option 1: Drop the entire schema You will need to re-create the schema and its permissions. This is usually good...
...enough for development machines only. DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO public; Applications usually use the...
If you get one of this errors: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: ( ): found character that cannot start any token while scanning for the...
Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method...
...column, remove_column, etc. more than once in a migration makes that migration run slower than it should. Use change_table instead. Consider this migration: add_column :users, :name, :string...
...users, :cool, :awesome Migrating in this case means that all those commands are processed step by step, causing 4 SQL statements to change the table. In turn, your database needs...
jQuery comes with .animate() that lets you transition some CSS selectors: function floatIn($element) { $element.css({ 'opacity': 0, 'margin-top': 200px }); $element.animate({ 'opacity': 1, 'margin-top': 0 }, { duration: 500 }); }
...is implemented using setInterval and Javascript. This works great, but it's not as smooth as a CSS transition. Fortunately the animate API can be mapped almost 1:1 to...
Large projects usually have large test suites that can run for a long time. This can be annoying as running tests blocks you from picking up the next story -- but...
...it doesn't have to be that way! Simply clone your project's repo twice (or even more often). When your work on a feature branch is done, simply push...
...expression that forces a repaint (e.g. by computing an element's width, or running something like element.is(':visible')) you may end up with "page flickering" or scroll offset changes.
...to the end of a digest cycle to avoid that. The following is basically straight from the docs, but pretty awkward to use. Do it like this (example here is...
There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote_column_name(field) scoped(:select => "COUNT(DISTINCT #{field}) AS count...
Although the given variable is sanitized here, the MySQLAdapter's (and probably other adapters as well) method for this is insufficient as it only wraps backticks around it, not...
...not migrated yet). $ rake db:rollback $ If that happens to you, check your migration status. $ rake db:migrate:status up 20160503143434 Create users up 20160506134137 Create pages up 20160517112656 Migrate...
...to roll back the latest change that was migrated. In the case above, your schema_migrations table contains an entry 20160518112023 that you do not have the corresponding migration file...