...the parsing to ruby_parser. Unfortunately, ruby_parser appears to be confused when a string contains both escaped chars (that is, any unicode characters as ndash, umlauts etc.) and #{} blocks...
...which makes it extremely slow. The easiest "solution" we came up with was to replace all occurrences of UTF-8 chars with their HTML entities (so "ü" instead of "ü...
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...
...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...
TLDR: A function is hard to use when it sometimes returns a promise and sometimes throws an exception. When writing an async function, prefer to signal failure by returning a...
...rejected promise. The full story When your function returns a promise ("async function"), try not to throw synchronous exceptions when encountering fatal errors. So avoid this: function foo(x) {
This only works when you actually have a session ID (not the case for Rails' CookieStore, for example): request.session_options[:id] # => "142b17ab075e71f2a2e2543c6ae34b94" Note that it's a bad idea to...
...expose your session ID, so be careful what you use this for...
This error occurs when passing an object instead of a string to Jasmine's describe(): # Bad describe(HoverClass, function() {...
# Correct describe('HoverClass', function...
If you want to do JavaScript-style camelization, ActiveSupport's String#camelize method can actually help you out. Simply pass a :lower argument to it. >> 'foo_bar_baz'.camelize
You select some characters, make them bold and suddenly your entire document is bold? Here's how to fix that: Right-click the style in the "Styles and Formatting" window...
...Select "Modify" Go to the "Organizer" tab Unselect "AutoUpdate" You're welcome...
...our app(s). In the beginning, there was the monolithic Rails app in the standard way with 100+ models and their many corresponding controllers and views. Then we moved to...
...between the (initial) straightforwardness of the single Rails app and the modularity of the more service-oriented architecture...
Pdfposter is a Python script that allows to convert large PDFs into a PDF with multiple pages that can be printed and turned into one big poster. In Ubuntu, you...
...can install it with sudo apt-get install pdfposter Scaling to the desired size is a bit cumbersome. If you want to split large.pdf, I suggest you run pdfposter -vns...
With Rspec you can mock objects or functions, for example like this: expect(my_object).to receive(:my_function).and...
There is a bug in Rails 3's dbconsole script, which makes the following command open a database console for the development environment: rails dbconsole -p test
This will reduce the filesize of foo and bar to 0 bytes: truncate -s0 foo bar If the files do not exist they will be created. You can use this...
...to easily truncate your application's log files: truncate -s0 log/*.log
...have to write an HTML message for some weird reason. Here is how: Hold the Shift-Key while clicking on "Write", "Reply", "Reply All", or "Forward".
...the following way: if object is a block, it converts the block into a simple proc. if object is a Proc, it converts the object into a block while preserving...
...the lambda? status of the object. if object is not a Proc, it first calls #to_proc on the object and then converts it into a block...
Let's say you have a folder images and want to to move all files in there to a new subfolder public. cd images mkdir public mv !(public) public
...public) excludes the new subfolder itself from being moved...
...its columns, you can use the following CSS property: table-layout: fixed It is supported by every browser ever...
When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly all commands. # Migrate rake db:migrate rake db:migrate STEP...
...rake db:migrate VERSION=20080906120000 # Redo rake db:migrate:redo rake db:migrate:redo STEP=2 rake db:migrate:redo VERSION=20080906120000 # Rollback (starting from latest migration) rake db:rollback...
...original DOM (template element) before AngularJS creates an instance of it and before a scope is created. Use the pre-link function to implement logic that runs when AngularJS has...
With Rails 4, Concerns have become the “official” solution to the big-models problem. However, there’s a fair amount of controversy about this topic in the community. Not everyone...
...is convinced that Concerns are the “right“ solution to the problem of AR models becoming too big. In this talk we will see what Rails Concerns are and how can...
When you put a Rake task into lib/tasks, but running it fails with... Don't know how to build task...
...or overflow directives in your CSS. Remove and tags in proximity of your table (seriously...
not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's Guide...
Safari & Chrome Use $x() in your console: $x('//span') # selects all span elements Firefox There's an add-on...
If your Snom 300 always keeps the same volume for headset and ringtone (as soon as you change one you also change the other), here's what to do:
...to your phone settings web interface, then Preferences (German Präferenzen). There is the seemingly harmless setting for Ringer Device from Headset (German Klingeltonausgabe bei Kopfhörer). Choose one: "Headset" or "Speaker...