...update your window title whenever you switch directories, simply specify a PROMPT_COMMAND environment variable. set-window-title() { echo -en "\033]0;$(pwd | sed -e "s;^$HOME;~;")\a" } if [[ "$PROMPT...
...COMMAND" ]]; then export PROMPT_COMMAND="$PROMPT_COMMAND;set-window-title" else export PROMPT_COMMAND=set-window-title fi You may put that into your ~/.bashrc to persist and automatically activate...
Stop MySQL: sudo service mysql stop Move (or copy) your mysql directory. If you want /mnt/mysql to be the new directory, do it like this:
.../var/lib/mysql /mnt/ Open your MySQL configuration (sudo vim /etc/mysql/my.cnf) and change the datadir value to your new path (e.g. /mnt/mysql) Modify your AppArmor configuration: sudo vim /etc/apparmor.d/usr.sbin.mysqld Change/copy the lines...
This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the ActiveRecord ORM used with Ruby on Rails, but the techniques...
We will be using this example tree (from the acts_as_nested_set docs): root | +-- Child 1 | | | +-- Child 1.1 | | | +-- Child 1.2 | +-- Child 2 | +-- Child 2.1 | +-- Child 2.2
...you are done and all is well: remember to remove those entries again, or set the log level to 0, to switch off rewrite logging...
This step will pass if the specified select is sorted. Then /^the "(.*?)" select should be sorted$/ do |label, negate| select = find_field(label) options = select.all('option').reject { |o| o.value.nil? } options.collect...
...this custom matcher, the each_cons block can be replaced with: options.should be_naturally_sorted Usage Then the "Organizations" select should be sorted Depends on Capybara. This step is now...
...or not to gem": Gem is really needed (prefer writing your own code for simple requirements without many edge cases) Gem is tested well (coverage and quality)
...the project requirement Try to avoid gems that do much more than your requirement scope needs Gem has a good maturity and maintenance Gem has a good / familiar DSL
After a recent Ubuntu update I didn't see the main menu bar of the RubyMine IDE (File | Edit | View | ...) anymore. This could be solved by changing a RubyMine registry...
Search "registry" within the "Actions" search press ctrl + alt + n > click on Actions > type registry > click on Registry... Scroll down to linux.native.menu and disable the checkbox After rebooting RubyMine...
Stepping forward from JavaScript Basics, the goal of this card is for you to be able to read and write more complex ES6+ code. The JavaScript Object Model
...s also a video of that talk in our internal library. The first three sections of the article Inheritance and the prototype chain on mdn also gives a good introduction...
PostgreSQL supports the SQL OVERLAPS operator. You can use it to test if two date ranges overlap: => SELECT ('2001-02-16'::date, '2001-12-21'::date) OVERLAPS...
overlaps -------- true An important caveat is that the date ranges are defined as start <= time < end. As such the later date is not included in the range:
...handy when values have an implicit ordering. Let's imagine a record Issue(criticality: string). criticality should have the following three possible values: critical, medium, low. Sorting with Issue.all.order(criticality...
...critical' issue This happens because the database column backing the criticality attribute is a string and PG will use a collation to determine the result of comparisons. In most collations...
Sometimes, due to git or other "accidents", important files get deleted or overwritten. At a state when even Ctrl+Z doesn't work anymore, you maybe can rescue your files...
...that file in the editor Go to RubyMine and click on VCS -> Local History -> Show History In the now open window, you should see all greater changes made to the...
Never use raise_error without specifying the Error you expect. expect { do_a_lot_of_complicated_stuff }.to raise_error will be green if you make any error in programming...
...E.g. a simple typo would make the test above green. The block will catch the Spec:: exception and the test will be happy. Be sure to always have custom errors...
If you have trouble updating something on FreeBSD you should always take a look in the UPDATING file. For this error there is this solution which worked perfectly for me...
...There was a nasty bug introduced in the update below, it was introduced in svn revision 373476 and corrected in 373485. If you get errors looking like this one: ===> Registering...
...behavior, you can explicitely tell ActiveRecord how to preload associations with either JOINs or separate queries. This card gives an overview of the different options to preload associations, but
...for preloading! Please have a look on on our card why you should be super careful with complex eager_load or includes queries. Thus, as a general guideline.includes or .eager...
While RSpec 1 and 2 decided that specs inside spec/model are model specs, and those inside spec/features are feature specs (and so on), RSpec 3 will no longer do that...
...such as missing routing helpers, etc. There are 2 ways to fix this: Explicitly set the type on each spec. For example: describe '...', type: 'feature' do # ... end
When debugging slow SQL queries, it’s helpful to understand the database engine's query plan. Whenever you execute a declarative SQL query, the database generates a "query plan" that...
...outlines the exact steps the engine will take to execute the query. Most of the time, we don’t need to worry about this plan because SQL engines are highly...
...the everyday use without any parameter tweaking I'm using a collection of tiny scripts in my ~/bin folder that can then be used as bash functions. And: It's...
...video-to-audio /path/to/cake.mp4 cake.mp3 audio-to-audio /path/to/cake.mp3 cake.aac image-to-image /path/to/cake.png cake.jpg stateDiagram-v2 text --> image: Dall-E 3 text --> audio: GPT TTS image --> text: GPT Vision...
Postgres supports multiple built-in range datatypes: int4range int8range numrange tsrange (range with timestamp without timezone) tstzrange (range with timestamp with timezone) daterange They represent a start and endpoint of...
...something in a single column. Image you're building a vacation booking feature: create_table :events do |t| t.date :starts_on t.date :ends_on end This is how you would...
...It must be fixed by patching the Jasmine sources. Fix for Webpacker Add the package string-replace-loader to your package.json. If you're on Webpacker 5 (Webpack 4) the...
...your config/webpack/environment.js: environment.loaders.prepend('fix-jasmine4-global-detection', { test: /jasmine-core\/lib\/jasmine-core\/jasmine\.js$/, use: [{ loader: 'string-replace-loader', options: { search: 'window.toString() === \'[object GjsGlobal]\'', replace: 'window.toString() === \'[object Window]\'' } }] }) Fix for ESBuild...
WebRTC HTTP/2 is here, let’s optimize! or, why (some) yesterday's best-practices are today's HTTP/2 anti-patterns...
...browser trust the certificate so it does not show warnings for your own certificate. Easy: self-signed certificate To just create a certificate for localhost, you can use the following...
...can then access your application at https://localhost:3000/. Your browser will complain about the self-signed certificate, but you can ignore the warning in that case, since you are...
If the application under test makes sound, you probably want to disable this during integration testing. You can use the args option to pass parameters to the browser. For Chrome...
...Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new(app, browser: :chrome, args: ["--mute-audio"]) end I haven't found a corresponding command line option for Firefox. Hat tip to kratob...
Scroll and touch event listeners tend to be computationally expensive as they are triggered very often. Every time the event is fired, the browser needs to wait for the event...
...quoted from WICG's explainer on passive event listeners. See this demo video for a side-by-side comparison. While there are particular scenarios where an author may indeed want...
...you're already doing it wrong, but maybe the hour is late and your standards for success are slipping. Anyway here is how to hide the controls in the default...
...Flash video player component: Select the player frame on the stage. Open the component inspector by selecting Window -> Component Inspector or clicking a funny unlabeled icon in the player properties...