This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var imageSource = $('.main-photo').src; | |
var photoPage = window.location.href; | |
var htmlString = '<a href="' + photoPage + '"><img src="' + imageSource + '"></a>'; | |
console.log(htmlString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Yes, I'm going to CSS hell! Install stylish browser extension then add this for clubhouse.io */ | |
/* We don't find story and user ID useful so hide them */ | |
.bucket-content .story-id, | |
.project-name { | |
display: none; | |
} | |
/* Font size 0 needed to hide forward separator between owners */ | |
.bucket-content .story-summary { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openLunch() { | |
var restaurant = sheet.getRange("B1").getValues()[0][0]; | |
var deadline = sheet.getRange("B2").getValues()[0][0]; | |
triggerSlackRequest("main", "@london: FRIDAY LUNCH: *"+ restaurant +"*. Please order by *"+ deadline +"*. Cheers.\n"+ sheetURL); | |
createTimeTriggers(2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createTimeTriggers(hour) { | |
ScriptApp.newTrigger('lunchReminder') | |
.timeBased() | |
.everyHours(hour) | |
.create(); | |
ScriptApp.newTrigger('notifyOrdersAppearCompleted') | |
.timeBased() | |
.everyMinutes(5) | |
.create(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function triggerSlackRequest(channel, msg) { | |
var slackWebhook = "YOUR PERSONAL SLACK TOKENIZED URL"; | |
var payload = { "channel": channel, "text": msg, "link_names": 1, "username": "lunchbot", "icon_emoji": ":hamburger:" }; | |
var options = { "method": "post", "contentType": "application/json", "muteHttpExceptions": true, "payload": JSON.stringify(payload) }; | |
Logger.log(UrlFetchApp.fetch(slackWebhook, options)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function notifyOrdersAppearCompleted() { | |
var curHour = new Date().getHours(); | |
var notifiedCell = sheet.getRange("F3").getValues()[0][0]; | |
if (notifiedCell == true) { | |
return | |
} | |
if (curHour > 17 || curHour < 9) { | |
Logger.log("Outside work hours stopping"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function closeLunch() { | |
var triggers = ScriptApp.getProjectTriggers(); | |
updateUnattendingRows(); | |
triggerSlackRequest("main", "Lunch orders are now closed"); | |
triggerSlackRequest(completedOrdersUser, "Lunch is now officially closed"); | |
for (var i = 0; i < triggers.length; i++) { | |
if (triggers[i].getHandlerFunction() == "lunchReminder" || triggers[i].getHandlerFunction() == "notifyOrdersAppearCompleted") { | |
ScriptApp.deleteTrigger(triggers[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateUnattendingRows() { | |
var attendingValues = sheet.getRange(startRow,4,rowRange,1).getValues(); | |
var color = "lightgrey" | |
for (var i = 0; i < attendingValues.length; i++) { | |
var rr = sheet.getRange("A"+(i+startRow)+":I"+(i+startRow)) | |
if(attendingValues[i][0] === false && rr.getBackground() != color) { | |
rr.setBackground(color); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lunchReminder() { | |
var curHour = new Date().getHours(); | |
if (curHour > 17 || curHour < 9) { | |
Logger.log("Outside work hours stopping"); | |
return | |
} | |
var completedValues = sheet.getRange(startRow,1,rowRange,1).getValues(); | |
var slackNames = sheet.getRange(startRow,2,rowRange,1).getValues(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
# Set variables | |
set chrome to "Google Chrome" | |
set zoom to "zoom.us" | |
set wait to 0.5 | |
set initialWindow to "Zoom - Pro Account" # If you're not using Zoom Pro you will need to change this | |
tell application chrome | |
if it is running then |
OlderNewer