echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`
describe "My page" do | |
it "lists the item" do | |
item = create_item | |
within item_row(item) do | |
expect(page).to mention_item(item) | |
end | |
end | |
private |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
export default Ember.Component.extend({ | |
interval: 1000, | |
timer: null, | |
startTimer() { | |
const timer = Ember.run.later(this, () => { | |
this.sendAction('tick'); | |
this.startTimer(); | |
}, this.get('interval')); | |
this.set('timer', timer); | |
}, |
# Compresses all .js and .css files under the assets path. | |
namespace :deploy do | |
# It is important that we execute this after :normalize_assets because | |
# ngx_http_gzip_static_module recommends that compressed and uncompressed | |
# variants have the same mtime. Note that gzip(1) sets the mtime of the | |
# compressed file after the original one automatically. | |
after :normalize_assets, :gzip_assets do | |
on release_roles(fetch(:assets_roles)) do | |
assets_path = release_path.join('public', fetch(:assets_prefix)) | |
within assets_path do |
# Reference: https://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/ | |
require 'webrick' | |
class Echo < WEBrick::HTTPServlet::AbstractServlet | |
def do_GET(request, response) | |
puts request | |
response.status = 200 | |
end | |
def do_POST(request, response) | |
puts request |
Recently, I upgraded from ember-qunit 0.3.1 to 0.3.2. The main reason I wanted to upgrade was to take advantage of a new way of writing component tests.
Previously, there was no way to test how the component was actually used. A component test could instantiate a component and poke at its internals, but that isn't how we use components. We use them declaratively in templates. The old style also meant it was difficult to test block templates and impossible to test block parameters.
I really wanted the new test style, but it wasn't easy to get there. The following are my upgrade notes.
Many of my old component tests looked like