Mac OSX Tips

⌘ + ⌃ + Space Floating emoji keyboard

Character & hold Special characters, e.g. ñ, ë etc.

⌘ + ⇧ + V Pastes unformatted clipboard text

⌃ + Space Spotlight fast search (serves also as calc)

⌘ + ⌃ + D Dictionary for highlighted word

fn + Delete Deletes text forward (similar to del key on Windows)

Power & hold Shutdown popup

⇧ + ⌥ + F11/F11 Fine tune volume

⌘ + ⇧ + 4 Area screenshot

⌘ + Tab All running windows switch

⌘ + Q Close active app

⌘ Command key
⌃ Control key
⌥ Option key
⇧ Shift Key
⇪ Caps Lock
fn Function Key

When To Choose SVG Over WebGL

  • Simple 2D games and applications - Canvas maybe a better choice given that it has more support and many 2D focused libraries
  • Search - Currently, WebGL content is not understood by search engines
  • DOM integration - WebGL contains no way to attach event handlers to page elements
  • Older browsers - WebGL is not ideal when your user-base has older browsers
  • Highly secure environments - WebGL could pose security issues

Source: Why you should learn WebGL

What ‘use strict’ Good For?

  • Makes debugging easier - shows error messages that otherwise won’t be shown
  • Prevents accidental globals - declaration of variables w/o var
  • Eliminates this coercion - null or undefined references won’t be automatically coerced to the global.
  • Disallows duplicate property names or parameter values - var object = {foo: "bar", foo: "baz"}; or function foo(val1, val2, val1){} are not allowed
  • Makes eval() safer - statements variables declared inside eval stay there
  • Throws error on invalid usage of delete - operator is not allowed on non-configurable parameters

Source: 16 Great JavaScript Interview Questions

ECMAScript 5 Array Methods

// Do all elements satisfy predicate?
Array.prototype.every(predicate)

// Return a new array with the elements that satisfy predicate?
Array.prototype.filter(predicate)

// Call action(element) for each element
Array.prototype.forEach(action)

// What is the index of the first element that equals value?
Array.prototype.indexOf(value, fromIndex)

// What is the index of the last element that equal value?
Array.prototype.lastIndexOf(value, fromIndex)

// Create a new array by applying unaryFunc to each element
Array.prototype.map(unaryFunc)

// Reduces the elements of the array, by applying binaryFunc between the elements [a0, a1].reduce(+ , seed) == seed + a0 + a1
Array.prototype.reduce(binaryFunc, seed)

// Is at least one element satisfied by the predicate? Array.prototype.some(predicate)