Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.
You've got two main options:
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "golang.org/x/sys/unix" | |
| ) | |
| // https://www.gnu.org/software/libc/manual/html_node/Sockets.html#Sockets |
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(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| class GroupersController < ApplicationController::Base | |
| def create | |
| @grouper = Grouper.new(leader: current_member) | |
| if @grouper.save | |
| ConfirmedGrouperEmails.new(@grouper).deliver | |
| AssignBarForGrouper.enqueue(@grouper.id) | |
| redirect_to home_path | |
| else |
| class GroupersController < ApplicationController::Base | |
| def create | |
| @grouper = Grouper.new(leader: current_member) | |
| if @grouper.save | |
| confirm_grouper_via_emails(@grouper) | |
| enqueue_bar_assignment(@grouper) | |
| redirect_to home_path | |
| else |
| // Load Ember into the global scope by requiring it | |
| require('ember'); | |
| // Go have fun | |
| var app = Ember.Application.create(); |
| // A basic example of how Ruby's constantize _could_ work in JS | |
| // See https://apidock.com/rails/String/constantize | |
| function constantize (str) { | |
| if (typeof str !== 'string') { | |
| throw new TypeError('must pass in type of string'); | |
| } | |
| if (str.match(/\W|\d/)) { | |
| throw new SyntaxError('must pass in a valid Javascript name'); | |
| } |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Syscall on Intel 5150 ...................... 105 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Context switch on Intel 5150 ............. 4,300 ns = 4 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs