Skip to content

Instantly share code, notes, and snippets.

var match = location.href.match(/trello\.com\/([[cb])\/(.*)\//),
copiedLabels = JSON.parse(localStorage.getItem('copiedLabels')),
cookies, token, boardId, data;
if (match[1] === 'c') {
boardId = window.IdCache.getBoardIdForCard(match[2]);
} else {
boardId = window.IdCache.getBoardId(match[2]);
}
var match = location.href.match(/trello\.com\/([[cb])\/(.*)\//),
boardId;
if (match[1] === 'c') {
boardId = window.IdCache.getBoardIdForCard(match[2]);
} else {
boardId = window.IdCache.getBoardId(match[2]);
}
$.ajax('/1/boards/' + boardId).then(function(board) {
@alexgb
alexgb / rollbar debug.js
Created October 30, 2014 18:59
Rollbar debugging
(function() {
var oldRollbarError = Rollbar.error,
baseLogArgs = ['%c Rollbar ', 'background: #f55; color: white;'];
Rollbar.error = function() {
var args = Array.prototype.slice.call(arguments, 0);
console.log.apply(console, baseLogArgs.concat(args));
return oldRollbarError.apply(Rollbar, arguments);
};
@alexgb
alexgb / mock_versions.js
Created October 30, 2014 18:24
Test Vishnu Refresh
(function() {
var oldAjax = $.ajax;
$.ajax = function(url) {
if (url === '/version.json') {
return $.Deferred().resolve({"commit":"123","version":"v2"});
} else {
return oldAjax.apply($, arguments);
}
};
var values = {
// 1: Description
49: "Imagine you are creating a fence for a garden. Before you can make the fence, you need to make a model. Using Legos and Lego graph paper, make a model of the fence.",
// 2: Step One
50: "Your fence should be 20 units long and 10 units wide. Make your fence, take a picture of it and attach it to the card.",
// 3: Step 2
51: "Then, find the perimeter of the fence. If you do not remember how to find perimeter, click [here](http://www.brainpopjr.com/math/measurement/perimeter).",
@alexgb
alexgb / Segment Debugger.js
Last active February 28, 2017 19:27
Segment.io debugger
var _asAnalyticsMethodColors = {
identify: "#c66",
alias: "#c66",
track: "#66c",
page: "#c6c",
_default: "#888"
};
function _asAnalyticsLog(method, objects) {
var color = _asAnalyticsMethodColors[method] || _asAnalyticsMethodColors._default;
@alexgb
alexgb / gist:7434182
Last active December 28, 2015 03:19
Enter lorem ipsum into focussed input
$.ajax('https://baconipsum.com/api/?type=all-meat&sentences=3').then(function(results) {
var el = $(':focus');
var letters = results[0].split('');
el.val('');
var timeout = window.setInterval(function() {
var letter = letters.shift();
if (letters.length === 0) {
window.clearTimeout(timeout);
@alexgb
alexgb / gist:7433522
Created November 12, 2013 16:08
Vishnu hotfix
document.styleSheets[1].addRule('textarea', 'margin-bottom: 1em;');
@alexgb
alexgb / Gittip!.js
Last active December 14, 2015 20:38
Drag this link to your bookmarks toolbar. You can click it when on a Github account page to quickly tip someone when you use their code or like their project!
(function() {
window.location = 'https://www.gittip.com/on/github/' + document.URL.split('/').pop();
})();
@alexgb
alexgb / Diaeresis.js
Last active December 14, 2015 03:29
Because The New Yorker does it...
(function() {
var words = [
"Boötes",
"Brontë",
"caïquejee",
"Chloë",
"continuüm",
"coöperate",
"coöperation",
"coöperating",