-class @User +class window.User
requirestatement with Webpacker's
importstatement to load dependencies.
-#= require ./person +import './perso...
Recent versions of whenever are basically compatible with Rails 2. However, the
runner job type expects a
rails runner command and out-of-the-box fails on Rails 2.
every :day, at: '00:05 am' do runner 'Util.perform! end
To get this working on Rails 2, you need to redefine the
runner job type by putting this line to the top of config/schedule.rb:
job_type :runner, 'cd :path && :environment_variable=:environment bundle exec script/runner ":task"'
We're pleased to announce Ruby 3’s new language for type signatures, RBS. One of the long-stated goals for Ruby 3 has been to add type checking tooling. After much discussion with Matz and the Ruby committer team, we decided to take the incremental step of adding a foundational type signature language called “RBS,” which will ship with Ruby 3 along with signatures for the stdlib. RBS command line tooling will also ship with Ruby 3, so you can generate signatures for your own Ruby code.
Ruby 3 is coming, and it will have optional type sign...
For projects that do not have a separate account for separate environments you can simply filter the events for your current environment in the search bar by typing
environment:production. IMHO it's better to have a separate project per ENV in order not to have to filter all the time.
Ag (aka "the silver searcher") is a very fast replacement for
It will parse your
.gitignore for additional speedup. To ignore even more files (
*.min.js etc), add an
.agignore with syntax identical to
On Ubuntu 14.04, don't install via apt-get, but build from source to get a current version.
See Faster Grepping in Vim for hints about vim integration.
RSpec 3 has verifying doubles. This breed of mock objects check that any methods being stubbed are present on an instance of a given class. They also check methods aren't called with the wrong number of arguments.
This dual approach allows you to move very quickly and test components in isolation, while
giving you confidence that your doubles are not a complete fiction.
You should always prefer using a verifying double to using an old-...
Extended records now use their own I18n namespace when looking up translations for models or attributes. If the extended record's namespace does not contain a translation, the lookup will fall back to the base record's namespace.
For instance, given the following class hierarchy:
class User < ActiveRecord::Base end class User::Form < ActiveType::Record[User] end
ExtendedParent.human_attribute_name(:foo) would first look up the key in
activerecord.attributes.user/form first, then falls back to `activerecord.attributes...
We're huge fans of Sidekiq for its stability and features. One advantage of GoodJob over Sidekiq is that GoodJob doesn't require Redis. So in cases where you don't have Redis or don't want to pay for a Redis HA quorum node, this might be an alternative worth checking out.
These warnings are printed when the
etc Gem is installed, while
etc is also included in Ruby. Fix with:
gem uninstall etc
This guide shows how to create an AngularJS application that consumes more and more memory until, eventually, the browser process crashes on your users.
Shift + ESCto see a list of Chrome processes...
Find-as-you-type boxes are usually built by observing changes in a text field, and querying the server via AJAX for search results or suggestions when the field has changed.
A common problem with this implementation is that there is no guarantee that AJAX responses are evaluated in the same order as the original requests. The effect for the user is that the search results are flashing back and forth while the user is typing the query, and when the user has stopped typing the last results don't always match the final query.
You won't notice...
CONCAT('foo', 'bar', NULL) = NULL
the NULL always wins in MySQL.
If you would rather treat NULL as an empty string, use
CONCAT_WS (concatenation with separator) instead:
CONCAT_WS('', 'foo', 'bar', NULL) = 'foobar'
In PostgreSQL the
NULL is not viral in
CONCAT('foo', 'bar', NULL) = 'foobar'
We use Sentry to be informed about different kinds of issues. One of the key features is that you are not getting spammed if many errors of the same kind occur in a small timespan.
If an issue pops up the usual workflow is to fix the code and mark the issue as "resolved" in Sentry. Only new or resolved issues trigger another email notification when they are proxied through Sentry.
This workflow does not fit well for issues we cannot fix, e.g. when consuming an external API that is sometimes down. In such cases you ...
geordi consolecan take the number of the server to connect to it directly and to skip the menu. Example:
geordi con production -s4
Most forms have a single submit button that will save the record when pressed.
Sometimes a form needs additional submit buttons like "accept" or "reject". Such buttons usually attempt a state transition while updating the record.
To process a form with multiple buttons, your server-side code will need to know which button was pressed. To do so you can give each submit button a different
[formaction] attribute. This will override the ...
This is called "cherry-picking".
git cherry-pick commit-sha1
Note that since branches are nothing but commit pointers, cherry-picking the latest commit of a branch is as simple as
git cherry-pick my-feature-branch
Be aware that cherry-picking will make a copy of the picked commit, with its own hash. If you merge the branch later, the commit will appear in a history a second time (probably without a diff since there was nothing left to do).
Also see our advice for [cherry picking to production branches](https://makandraca...
Open-source software (OSS) is great. Anyone can use virtually any open-source code in their projects.
Well, it depends. Licenses can make things difficult, especially when you are developing closed-source software. Since some OSS licenses even require the employing application to be open-sourced as well (looking at you, GPL), you cannot use such software in a closed-source project.
To be sure on this, we have developed a project-level integration of Pivotal's excellent [license_finder](https://g...