Skip to content

Instantly share code, notes, and snippets.

@toddbc
toddbc / releaseNotes.js
Last active October 14, 2020 06:41 — forked from nadavspi/releaseNotes.js
toddbc's release notes helpers
// All non-merge commits
reg = /^(.+?)(\n|$)/; ' * ' + Array.prototype.slice.call(document.querySelectorAll('#commits_bucket .Details a')).map(el => el.title).filter(title => title && title.indexOf('Merge') !== 0).map(title => { var mm = title.match(reg); return mm && mm[1]; }).join("\n * ");
// Only merge commits
reg = /^[^#]+(#[0-9]+)[^\n]+\n\n((?:.|\n)+)$/; ' * ' + Array.prototype.slice.call(document.querySelectorAll('#commits_bucket .Details a:first-of-type')).map(el => el.title).filter(title => title.indexOf('Merge') === 0).map(title => { var mm = title.match(reg); return mm && mm[2] + ' (' + mm[1] + ')'; }).filter(Boolean).join("\n * ");
function LOE(tasks) {
return tasks.map(task => effortUnits(task)).reduce((a, b) => a + b);
}
function effortUnits() {
return [6, 8, 40][Math.floor(Math.random() * 3)];
}
@hdragomir
hdragomir / sm-annotated.html
Last active June 13, 2024 03:01
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@nifl
nifl / grok_vi.mdown
Created August 29, 2011 17:23
Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)