RSpec allows you to mark a single Example/ExampleGroup so that only this will be run. This is very useful when...
"Special object attributes" like frozen, tainted and singleton methods are ignored (like dup) Behavior depends on implementation Hash: returns a deep copy, i.e. referenced objects/values will be deep_duped...
...test (of course, you should be using parallel_tests). However, in projects that go beyond clicking around in a web GUI and checking results, there might be various measures to...
Both knapsack and parallel_tests have the option to split groups by historic execution time. The required logs for this...
When you allow file uploads in your app, a user might upload content that hurts other users. Our primary concern...
...use a library like Lodash or Unpoly's up.util that will hide this inconsistency behind functions like _.isBoolean(x) or _.isObject(x). However, I encourage every JavaScript developer to understand...
...JavaScript has a caveat that typeof null returns 'object'. No developer would consider this behavior useful, since you cannot get or set properties with null. Taking into consideration all of...
...many thousand rows. Once your database tables grows to millions of rows, migration performance becomes an issue. We will talk about this in another card. 1. Use the full power...
...updates with it. As a first example, we have Post has_many :followers. For better performance, we want to cache the number of followers in Post#followers_count.
...Compliance Level; Asset file size could be reduced 2 New slider library has a better API Add capybara_lockstep 2 0 - 5 Reduce flaky integration tests
...dumps can be created in multiple formats (see option -F in pg_dump documentation. Benefits of the custom format are more configurable restores (for e.g. you can omit setting permissions...
...speeds up restores). The custom dump is compressed by default too. To get a better idea check the parameters in the mentioned documentation. You can use a custom format dump...
Here are some popular mistakes when using nested forms: You are using fields_for instead of form.fields_for.
...selectively for your current need of change. For a more detailed example on this behavior compared to the --worktree option you can have a look on the example within the...
...git restore with --source for the usage --staged compared to --worktree To get a better idea, why this behavior might be useful I will add an example for both commands...
TypeScript Code Playground Let's take a look at the same behavior for functions: interface User { name: string; age: number; } function greet(user: User) { console.log(`Hello ${user.name}`); }
...type assertion. You're saying: "Treat this variable as a different type; I know better than what you can guess." This can be useful when you're retrieving a point...
...application does not need to support time zones. Disable them like this: config.time_zone = 'Berlin' # Your local time zone config.active_record.default_timezone = :local config.active_record.time_zone_aware_attributes = false
...s Time will use that. In the example above, it should be in the Berlin zone. Using time zones If your application should support time zones, the default ActiveRecord configuration...
Your objects are now inspected with pretty colors: Note that if your inspection becomes wider than your terminal, IRB will automatically break it across multiple lines, like you probably...
When an event listener on a DOM element throws an error, that error will be silenced and not interrupt your...
...need a library for it. With ActiveRecord you could implement it with a single belongs_to association: class Node < ActiveRecord::Base belongs_to :parent, class: 'Node' end Any modification of...
...issues, where you want to have a specific order of after_commit actions. Documented behavior Taken from the API documentation Registers a block to be called after all the current...
...may feel odd that the SQL statement says "UPDATE new_table". If your migration becomes too complex, you could put your logic into multiple reversible blocks (so they contain only...
end end A word of advice: Depending on your migration, you might be better off just defining 2 separate up and down methods instead of using change...
...I've seen examples using directory but there are no indications this attribute will become standard soon. Feel free to use to feel future-proof. On JavaScript file objects, webkitRelativePath...
...data is guaranteed. There are however cases where you want to improve the user behavior (Rails error box) or reduce the number of exceptions e-mailed to your / collected by...
...named main, add a file app/webpack/packs/main.js. This will be your entry point. All assets belonging to that pack need to be imported here. Since webpack is configured to use Babel...
...its own import statements to load any dependencies it might have. Since this quickly becomes cumbersome, we usually add the following to simply import all our JavaScript files at once...
...first get a general overview of the most popular solutions. To chose a single "best" of those, ask yourself questions such as: Is the library still maintained? When was the...
...level of our own standards. Does it have a ton of dependencies? Fewer is better, in this case. Sites like the Ruby Toolbox (only for gems) or npm compare may...
...request and model using implicit and convoluted protocols. We prefer a different approach. We believe that among all the classes in a Rails project, controllers are some of the hardest...
...to test and understand and should receive special care. It is our belief that: Controllers should be short and tidy Controllers should receive the same amount of programming discipline as...
So you have a heading that is just barely wider than the container it should fit into, and it wraps...