Skip to content

Instantly share code, notes, and snippets.

Working from home

Newton iamnewton

Working from home
View GitHub Profile
iamnewton / javascript-for-vim-refactoring.js
Created Sep 25, 2015 — forked from derwiki/javascript-for-vim-refactoring.js
Moving faster with Vim (5-minute lightning talk presentation). I wasn't inspired to learn effective command of Vim until I saw some people flying around faster than I thought was possible. The goal of this presentation is to call out how slow "normal" text editing is, and how many keystrokes can be reduced by using increasingly more terse Vim co…
View javascript-for-vim-refactoring.js
$(function() {
// good opportunity to combine into a single statement
// qq w cw <esc> A, <esc> 0 j q
var a = 10;
var b = 20;
var c = 30;
var d = 40;
var e = 50;
// opportunity to simplify syntax
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
local name=$(basename "$0")
iamnewton /
Last active Feb 4, 2016 — forked from lancejpollard/
A collection of meta tags supported by most browsers, including the custom ones for various browsers.

Copied from

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
iamnewton /
Last active Sep 19, 2015 — forked from paulirish/
What forces layout/reflow in Chrome. The comprehensive list.

What forces layout / reflow

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.


Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
View rubi.js
module.exports = function rubi( hook ) {
// has a range of node modules available - see
// We use request ( for an easy way to
// make the HTTP request.
var request = require( 'request' );
// The parameters passed in via the slash command POST request.
var params = hook.params;
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
NodeList.prototype.__proto__ = Array.prototype
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
iamnewton / domready.html
Last active Aug 29, 2015 — forked from dciccale/
DOM Ready: Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.
View domready.html
<!doctype html>
var DOMReady = function(a,b,c){b=document,c='addEventListener';b[c]?b[c]('DOMContentLoaded',a):window.attachEvent('onload',a)}
DOMReady(function () {
alert('The DOM is Ready!');
View very-small-ie-detect.js
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 6) then:
// ie === 0
// If you're in IE (>=6) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
# Just copy and paste the lines below (all at once, it won't work line by line!)
function abort {
echo "$1"
exit 1
set -e