Skip to content

Instantly share code, notes, and snippets.

/**************************/
/* B U L L E T S */
/**************************/
/* BULLET BACKGROUND COLOR */
.bullet {
background-color: #484848
}
/* BULLET HOVER COLOR */
a.bullet:hover {
border-color: #707070 !important;

Keybase proof

I hereby claim:

  • I am alaq on github.
  • I am alaq (https://keybase.io/alaq) on keybase.
  • I have a public key ASAyVKk5zZWL6Ec2VUzjABKT1bg1XIX6F87_4Cjrs6Vf6wo

To claim this, I am signing this object:

@alaq
alaq / sumStringsAsNumbers.js
Created June 8, 2017 22:05
JavaScript function to sum two strings as numbers and return the full string (no scientific notation).
function sumStrings(a,b) {
var arrayA = a.split('').reverse();
var arrayB = b.split('').reverse();
var arrayAB = [];
var remnants = 0;
for (var i = 0 ; i < Math.max(arrayA.length,arrayB.length); i++){
// if string is longer a or b, will clean up at the end
function arabicToRomanNumerals(number){
function stringMaker(times, letter, higherLetter, matchingNumber){
var str = '';
if (times < 5 || letter === 'M') for (var i = 0 ; i < times ; i++) str += letter;
else if (times === 4) str = letter;
return str;
}
var s = [];
@alaq
alaq / additions.sh
Created May 22, 2017 13:54
Tally up data added within a day, total bytes, and human readable format
#!/bin/bash
# Change folder and output below
# Run with @daily cron
folder=YOUR FOLDER
output=YOUR OUTPUT FILE
today=`date +%Y-%m-%d -d "yesterday"`
sum=$(find $folder -mtime -1 -printf "%s\n"|awk '{t+=$1}END{print t}')
@alaq
alaq / WorkFlowy.gs
Created May 18, 2017 21:18
Will scrape from your daily Workflowy summary emails the number of nodes created, changed or competed. For easy charting.
function WorkflowyStats() {
var emails = GmailApp.search('from:help@workflowy.com from:help@workflowy.com subject:your history');
var body = emails[0].getMessages()[emails[0].getMessages().length-1].getPlainBody();
bodysplit = body.split('------------------------------')[2].split(')')[0];
// to match every string of digits, see better solution below
// var values = bodysplit.match(/\d+/g);
var regExpCompleted = new RegExp("\\d+(?= completed)", "g");
@alaq
alaq / gmailStats.gs
Created May 18, 2017 21:14
When run, will return in a spreadsheet the number of emails in your inbox, as well as the number of emails received the previous day. Run it with a daily trigger at 1am.
function GmailEmails() {
var InboxThread = GmailApp.getInboxThreads().length;
var today = new Date();
var year = today.getYear();
var month = today.getMonth() + 1;
var day = today.getDate();
var day1 = day - 1;
var day2 = day;
var yesterdayThreads = GmailApp.search('-from:me after:' +year +'/'+month +'/'+day1 + ' before:' +year +'/'+month +'/'+day2);
@alaq
alaq / emailblaster.gs
Last active May 18, 2017 21:15
Simple mass emailer from a Google spreadsheet. In the first sheet B2 is the subject, B3 is the body, B4 is the hml body.
function sendEmails() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var subject = sheets[0].getRange("B2").getValue();
var textBody = sheets[0].getRange("B3").getValue();
var logoBlob = UrlFetchApp.fetch("http://i62.tinypic.com/6emz6f.png").getBlob().setName("logoBlob"); // Replace here with your own image
var inlineBody = sheets[0].getRange("B4").getValue();
var dataRange = sheets[1].getDataRange();
var data = dataRange.getValues();