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 * ");
@toddbc
toddbc / gist:951efc31e45960a90677
Last active August 29, 2015 14:06
continue pattern
foreach ($items as $item)
{
if (!$item->isActive())
continue;
// do stuff with $item
}
@toddbc
toddbc / facebooknocurl.php
Created March 19, 2014 00:06
Wrapper for Facebook class without using CURL.
<?php
// If these aren't defined, define them so the official API client doesn't cry.
if (!defined('CURLOPT_USERAGENT'))
define('CURLOPT_USERAGENT', 'CURLOPT_USERAGENT');
if (!defined('CURLOPT_CONNECTTIMEOUT'))
define('CURLOPT_CONNECTTIMEOUT', 'CURLOPT_CONNECTTIMEOUT');
if (!defined('CURLOPT_TIMEOUT'))
define('CURLOPT_TIMEOUT', 'CURLOPT_TIMEOUT');
if (!defined('CURLOPT_RETURNTRANSFER'))