.../.bashrc to have it always available. Adjust to your needs. Usage $> tab_title # title set to the current directory's name $> tab_title new_title # title set to "new_title...
...Auto-setting the title If you want your title to update each time you change the working directory, put this code after the function definition. # auto-title cd() { builtin cd...
Let's say you want to merge the properties of two JavaScript objects: let a = { foo: 1, bar: 2 } let b = { bar: 3, baz: 4 } let merged = merge(a, b...
...foo: 1, bar: 3, baz: 4 } Depending on your build, there are several ways to implement merge(). When you have ES6 When you have an ES6 transpiler or don't...
Here is some JavaScript code that allows you to click the screen and get the clicked element's text contents (or value, in case of inputs). The approach is simple...
...element. When you click the overlay, we look up the element underneath it and show its text in a browser dialog. You can then copy it from there.
...duplication from the code is a seemingly easy task. In many cases it is pretty straight-forward – you look at similar bits of code and you move them to a...
...in other places. Right? No, not really. It is true that code that looks similar might be an indicator that there’s a duplication but it’s not the definitive...
...run by your web browser. As any JavaScript, you include a link to the script in your HTML, and…that’s that. LESS is now going to process LESS code...
...formatting. Headers, paragraphs, lists, it’s all good. What about the formatting of text in single-line text fields? If our form entry is a single line, that’s usually...
...behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec output is incredibly noisy. You could silence all warnings with ::ActiveSupport::Deprecation.silenced = true, but you...
...dependencies. It’s tempting to remove the tests altogether (the code will be burned soon too, right?), but I figured out something a little nicer a little while back in...
...pattern below. The module pattern gives you basic class concepts like a constructor, private state, public methods. Since the module pattern only uses basic JavaScript, your code will run in...
...that we want to translate into Javascript using the module pattern. It's a simple class with one private function: # Ruby class Dog def initialize(name) @name = name
By default, Devise redirects to a sign-in form when accessing a route that requires authentication. If for some reason you do not want this, but use Basic Authentication (and...
...disable password reset. Note that forcing Basic Auth means there won't be a pretty sign-in form any more which would include a link for sign-up or password...
...was missing some features on Ruby's RSS::Parser that I found in Feedjira: Speed Does not break on slightly malformed RSS feeds (like a missing length attribute on an...
When you're facing a somewhat complex Google Analytics setup and want to find out what's happening, you can use this Chrome extension. It's much simpler than other...
...like "Google Tag Assistant") and does just one job and does it well. To see what's happening, you need to open your developer console...
The team is responsible for building great software—that’s it. It’s the only thing the team is responsible for and it’s the only thing that they actually...
...control. In other words, the development team is committed to quality software...
...unknown, technique in Ruby. For certain types of problems (e.g. when you have a set of rules) this gives you such an elegant way of describing the solution. There’s...
...no meta programming or monkey patching involved, it’s short and sweet and best of all: it’s very intuitive...
Trample is a more flexible load simulator. Instead of a static list of urls, trample's configuration language is ruby. Using ruby's blocks (lambda functions), it's possible to...
The goal of modelling is to produce something substantially simpler than the world. This is achieved not through endlessly inventing new types and relationships -- in fact, it's just the...
...s by eliminating entities and restricting types that we get a model that's simpler than the world and thus useful...
TL;DR Debugging problems with javascript errors in cucumber tests is sometimes easier in the browser. Run the test, stop at the problematic point (with Then pause from Spreewald...
...and open VNC for Firefox. Features: It does not freeze your server like when you're using a debugger. (Compared to the Then console step) It enables interacting with the...
...was typical approach for object oriented languages, designed in the 90s. A thread is sequence of instructions that can be scheduled and executed in the context of a process. Several...
...at the same time. Ruby’s VM process allocates a memory heap, which is shared and writable by threads. If incorrectly coordinated, those threads can lead to unexpected behaviors...
2.ordinalize # => "2nd" 1002.ordinalize # => "1002nd" 1003.ordinalize # => "1003rd" -11.ordinalize # => "-11th" -1001.ordinalize # => "-1001st...
Geordi uses parallel_tests if available for running the test suite. To debug an application it is very unhandy to have multiple processes as your terminal I/O will not work...
...as expected once a breakpoint is hit. Even parallel_tests support an option to enable a single process run, it is not possible to pass this option through geordi. But...
When CoffeeScript was added to Rails 3.1 they forgot one very important part, the ability to use it when responding...
...dependeny of capybara gem 'nokogiri', '< 1.6' # dependency of capybara gem 'rubyzip', '< 1' # dependency of selenium-webdriver, rubyzip 1+ requires Ruby 1.9 gem 'cucumber_factory' gem 'database_cleaner', '< 1'
...spinner', '~> 0.2.5' gem 'launchy', '~> 2.1.2' With these versions set, selenium-webdriver will be at version 2.35.1. This is because all later versions depend on rubyzip 1+. More info. After upgrading...
Terminator has a cool feature that allows you to split your terminal into many panels and type in all of them at the same time. It's called broadcasting and...
...and could be very dangerous (e.g. if you're logged in to a production server in a terminal that is on another workspace). To prevent the broadcast from affecting other...
...class for the presenter instead of extending objects DCI-style. This allows them to add statically-defined callbacks and validations from ActiveModel with the syntax that we know and love...
...question: We should be clear about why a form model is a better place for screen-specific code than a plain old controller. Weren't controllers originally the place for...
...aws-credential-file ./aws-credential.txt The output should look something like this: arn:aws:iam::322191361670:server-certificate/www.example.com arn:aws:iam::322191361670:server-certificate/testCert Now you have to upload...
...and includes the server certificate Amazon Resource Name (ARN) and GUID: arn:aws:iam::322191361670:server-certificate/www.example.com-2011 ASCACexampleKEZUQ4K If you got the error message similar to A client error...