Skip to content

Instantly share code, notes, and snippets.

View themartorana's full-sized avatar

Dave Martorana themartorana

View GitHub Profile
@themartorana
themartorana / staged.js
Created December 14, 2017 15:09
Auto-management of receipts and shipping notifications
function handleStaged() {
Logger.log("Starting...")
handleStagedShipping();
handleStagedReceipts();
Logger.log("Done.")
}
function handleStagedReceipts() {
var getLabel = GmailApp.getUserLabelByName('_Stage/Receipts');
var setLabel = GmailApp.getUserLabelByName('Receipts');
@themartorana
themartorana / fastlyMonthToDateBill.py
Last active May 13, 2020 19:07
Calculate your month-to-date bill from Fastly with the billing API
# Requires Python 3
import requests
import locale
from typing import Dict, Tuple, List
from calendar import monthrange
from datetime import datetime
FASTLY_URL = "https://api.fastly.com/stats/usage_by_month?billable_units=true"
@themartorana
themartorana / clock.js
Last active June 22, 2016 18:53
Make the Archilovers clock on the Inspiration tab sweeping seconds.
// Here You can type your custom JavaScript...// Clock
function clock() {
var clockSeconds = document.getElementById('clock-seconds'),
clockMinutes = document.getElementById('clock-minutes'),
clockHours = document.getElementById('clock-hours');
function getTime() {
requestAnimationFrame(getTime);
@themartorana
themartorana / dogstatsd
Created May 5, 2016 16:48
dogstatsd rc.d file
#!/bin/sh
# $FreeBSD$
# PROVIDE: dogstatsd
# KEYWORD: shutdown
. /etc/rc.subr
name=dogstatsd
rcvar=${name}_enable

Keybase proof

I hereby claim:

  • I am themartorana on github.
  • I am davemartorana (https://keybase.io/davemartorana) on keybase.
  • I have a public key ASA6AcWSpUfxXC-hMBcdPNcogPZWtQkG8nsT0184Z9GLNgo

To claim this, I am signing this object:

@themartorana
themartorana / random.cs
Last active April 23, 2023 21:57 — forked from jakeobrien/gist:5503948
Flyclops Domino! Bone Randomization Code
// for Unity (C#)
public static void Shuffle<T>(this List<T> list)
{
System.Random rnd = new System.Random();
int n = list.Count;
while (n > 1) {
n--;
int k = rnd.Next(n + 1);
T obj = list[k];
list[k] = list[n];
@themartorana
themartorana / card_numbers.js
Created April 6, 2015 17:05
Flyclops Trello Card Numbers
/* Card Numbers */
// ======================================
//
// DOM Manipulation
//
// ======================================
// Fills in the card numbers on newly created cards
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
import datetime
import httplib2
# to see in detail what's going on, uncomment
# httplib2.debuglevel = 4
from apiclient.discovery import build
from oauth2client.client import OAuth2Credentials, OAuth2WebServerFlow
if __name__ == "__main__":
@themartorana
themartorana / mailplane.css
Created October 16, 2012 15:24
MailPlane Style Customization CSS
/* gmail-refreshest: a custom gmail css by @roycifer */
/* some button styles borrowed from twitter bootstrap */
/* @match mail.google.com */
body, td, input, textarea, select {font-family:"Helvetica Neue",helvetica,arial,sans-serif;}
.w-asV > .nH:last-child {display: none;}
.w-asV > .nH > .no , #gbx1, #gbx2{background-image: -webkit-linear-gradient(top,white,#F7F7F7);}
.w-as1.nr{height:27px;border-radius:3px;}
.gbeti#gb .gbqldr, .gbet#gbqlw .gbqldr, .gbesi#gb .gbqldr, .gbes#gbqlw .gbqldr{max-height:35px;margin-top:3px;}
.gbqfqw{border-radius:3px;}