Skip to content

Instantly share code, notes, and snippets.

@bmccormack
bmccormack / _readme.md
Last active December 13, 2016 00:54
Trello List Math

##Demo

img

##Installation

Ideally, I'd have a bookmarklet right here that you could just drag to your bookmark window, but I don't have that. You have to make your own. But it's pretty easy.

  1. Go to http://chriszarate.github.io/bookmarkleter/
  2. Check the first two options, "URL-encode..." and "Wrap...". You can leave the others unchecked.
@bmccormack
bmccormack / _README.md
Last active August 29, 2015 14:26
On TomTom Runner MySports site, convert Speed in MPH to Pace in minutes per mile

You'll need to click "laps" before running the bookmarklet.

@bmccormack
bmccormack / uk_to_us.js
Created May 20, 2015 19:33
In Unbabel, change the UK flag icons to US flag icons
$('p.fontStyle2 img[src^="https://s3.amazonaws.com/unbabel-production/static/img/lang/en.png"]').attr('src', 'https://s3.amazonaws.com/unbabel-production/static/img/lang/en-us.png')
@bmccormack
bmccormack / progress.js
Created May 18, 2015 21:38
What % of strings have been translated on my LocalizeJS order?
($('div.item').length - $('div.translation p:contains("Waiting for translation")').length) / $('div.item').length
@bmccormack
bmccormack / preferredLocale.js
Created May 14, 2015 18:53
Get the preferred browser locale (language)
// This is hacky. Have fun.
var identity = function(value) {
return value;
};
var compact = function(list) {
var results = [];
for (var i = 0; i < list.length; i++){
if (identity(list[i])) results.push(list[i]);
@bmccormack
bmccormack / make_vba_multiline.py
Last active September 14, 2017 07:55
Python script to read from standard input to fake multi-line VBA
import fileinput
print 'Dim str As String'
print 'str = ""'
to_print = []
for line in fileinput.input():
line = line.strip('\n')
line_vba = 'str = str & "%s"' % line.replace('"','""')
to_print.append(line_vba)
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int *pArrNumbers;
long pSum;
int pos;
int len;
int (*funcMovingAvg)(void *self, int nextNum);
} MovingAvg;
@bmccormack
bmccormack / movingAvg.c
Created March 31, 2015 01:05
Moving average example in C
#include <stdio.h>
int movingAvg(int *ptrArrNumbers, long *ptrSum, int pos, int len, int nextNum)
{
//Subtract the oldest number from the prev sum, add the new number
*ptrSum = *ptrSum - ptrArrNumbers[pos] + nextNum;
//Assign the nextNum to the position in the array
ptrArrNumbers[pos] = nextNum;
//return the average
return *ptrSum / len;
@bmccormack
bmccormack / help_scout_docs_edit_links.user.js
Created February 4, 2015 19:41
Add "Edit this article" links to Help Scout docs. You need to edit the docsID value first.
@bmccormack
bmccormack / help_scout_hide_negative_satisfaction_ratings.user.js
Created February 3, 2015 18:52
Hide Not Good and Okay satisfaction ratings in Help Scout conversations.
// ==UserScript==
// @name Help Scout - Hide Negative Satisfaction Ratings
// @namespace https://secure.helpscout.net
// @include https://secure.helpscout.net/*
// @description Hides Not Good and Okay satisfaction ratings within conversations
// @author Ben McCormack
// @version 1.0.0.0
// ==/UserScript==