One of the many useful features of TextMate is autocompletion of words. If I were in TextMate right now, I could write "au[tab]", and it would complete it to "autocompletion". RubyMine can do this, too. When you write a word (e.g. a variable name), just hit ALT + / repeatedly and it will offer all completions for the letters you typed. This action is called Cyclic Expand Word in RubyMine / IntelliJ IDEA.
This feature keeps you from mistyping variable names, saves you keystrokes and speeds up development. ~10 keystrokes to the price …
When your Cucumber feature seems to forget cookies / sessions when you run it with Selenium or capybara-webkit, check if the test travels in time like here:
Given the date is 1981-10-20 When I sign in Then I should see "Welcome!"
What happens here is that the Rails application serving pages runs in 1984, but the process running your Firefox or Webkit still lives today. This gap of 27+ years will expire most Cookies immediately.
If all you need is to freeze the time to a date, a workaround is to travel to the future instead.
Simplified the algorithm and made it database-agnostic.
Situation: You want to write a spec for a function inside an Angular service. This function at some point makes an API request and acts upon response. Notably, your Angular app employs uiRouter, although it is not used nor actually required for this test.
# Capitalized expressions are intended to be replaced with YOUR values
describe 'SERVICE', ->
module ($urlRouterProvider) -> # Prevent uiRouter's initialization, i.e. do not sync the current URL # with its r...
Internet Explorer until version 9 has some limitations when parsing CSS files
Summarized, these are:
To test the selector limit for a specific browser, check this CSS selector limitation test website.
When you run into this issue, the following links might be helpful to fix the problem. The Idea is to split up the css fi…
'object' for both arrays and
null, I rewrote the sections for object and array detection:
Let's start with the easiest case, a…
Like in any language, a
FLOAT will eventually corrupt data due to rounding errors.
DECIMAL, which has well-defined behavior for rounding and range overflows.
Added a permanent solution to clone via http proxy.
window.opener, if the target is on the same domain.
Even if the target site is on another domain, it still has some access and can for example manipulate
window.location to perform a phishing attack.
You may use a
rel="noopener" attribute to avoid this in modern browsers, except IE or Edge.
If you try to listen to events on elements that are nested inside a
<fieldset disabled>, Firefox will stop event propagation once the event reaches the fieldset. Chrome and IE/Edge will propagate events.
Since we often bind event listeners to
document this can be annoying.
You could solve it by…
<fieldset>, around your eleme…
HTTPie consists of a single http command designed for painless debugging and interaction with HTTP servers, RESTful APIs, and web services
It easy to use and has very nice defaults and coloured output which makes it good for local testing.
Usage examples with curl equivalent:
# curl post curl --data "foo=23&bar=42" https://example.org/blub # httpie post http https://example.org/blub foo=23 bar=42 # curl localhost curl localhost:3000/users # httpie localhost http :3000/users
To check if a method has been called in Jasmine, you first need to spy on it:
let spy = spyOn(window, 'alert') codeThatAlerts() expect(window.alert).toHaveBeenCalledWith('Important message')
To expect an object of a given type, pass the constructor function to
expect(spy).toHaveBeenCalledWith(jasmine.any(Object)) expect(spy).toHaveBeenCalledWith(jasmine.any(String)) expect(spy).toHaveBeenCalledWith(jasmine.any(Number))
To expect an oject with given key/value properties, use `jasmine.objectContaini…
Be careful when using buttons without a
type attribute, since browsers will consider them the default submit button of a form.
Suppose you have this form:
<form action="/save"> <input type="text" /> <button onclick="alert('Alert!')">Alert</button> <button type="submit">Save</button> </form>
If you press the enter key inside in the text input, browsers will trigger the first button and show the alert.
To fix this, add a
type="button" attribute to the first button.
When you print (or print preview) and elements are cut off (e.g. after 1st page, or "randomly") you should check your CSS rules for these:
Is there an element with "
display: inline-block" that surrounds your content? Make sure it has "
display: block" for printing.
This primarily affects Firefox and Internet Explorer. Chrome seems to be able to handle
inline-block elements in most cases.
Does the element itself, or a container, define "
overflow: hidden"? Use "
overflow: auto" (or maybe "
overflow: visible") instead.
Cookies without an expiration timestamp are called "session cookies".  They should only be kept until the end of the browsing session.
However, when Chrome or Firefox are configured to reopen tabs from last time upon start, they will keep session cookies when closing the browser. This even applies to tabs that were closed before shutting down the browser.
This is by design in Chrome and [Firefox](https://bugzilla.mozilla.org/buglist.cgi?bug_id=337551,345830,358042,362212,36…
By default, browsers will not wrap text at syllable boundaries. Text is wrapped at word boundaries only.
This card explains some options to make browsers wrap inside a long word like
Unicode has a soft hyphen character you can use to mark optional word division opportunities. The soft hyphen is an invisible character with zero width. Only when the browser decides to wrap at a soft hyphen, it is turned in…
When writing XLSX files, there are gems like rubyXL or axlsx. While they do offer features like formatting or graphs, to represent spreadsheet cells, they have to keep several Ruby objects in memory. When writing huge files, both will become slow and consume lots of memory.
Enter Xlsxtream, a Ruby XLSX library with less features (e.g. no individual cell styles) but which does away with the memory issue by streaming …