var emailAddressRE = regexp.MustCompile(`^(?i)(?:(?:\"[^\"]+\")|[a-z0-9!#$%&'*+\-\/=?^_` + "`" + `{|}~]+(?:\.[a-z0-9!#$%&'*+\-\/=?^_` + "`" + `{|}~]+)*)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$`)
if !emailAddressRE.MatchString("emmaly@example.com") {
panic("oops")
}
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 Convert-ACLToCustomObject { | |
param ([Parameter(Mandatory = $true)]$ACL) | |
# Define a custom type | |
class CustomADObject { | |
[object]$ADObject | |
[string]$Guid | |
CustomADObject([object]$ADObject, [string]$Guid) { | |
$this.ADObject = $ADObject |
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
/** @OnlyCurrentDoc */ | |
/** | |
* Fixes the dropdown pickers on the Elections sheet if they need it. | |
*/ | |
function fixPickers() { | |
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
const sheet = (spreadsheet.getSheets().filter((sheet) => sheet.getSheetId() === 123123) || []).shift(); | |
const pickListsSheet = (spreadsheet.getSheets().filter((sheet) => sheet.getSheetId() === 234234) || []).shift(); | |
const pickers = spreadsheet.getRangeByName("ProductPickers"); |
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
/** @OnlyCurrentDoc */ | |
/** | |
* @param {any} value - value to test | |
* @returns {boolean} - `true` if a number, `false` otherwise | |
*/ | |
function isNumber(value) { | |
return typeof value == 'number' && isFinite(value); | |
} |
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
/** | |
* Retrieves a value from the cache if it's still valid. | |
* @param {string} key - The key for the cached data. | |
* @param {number} expirationInMinutes - The time after which data should be considered stale. | |
* @returns {any} - The cached data, or null if it's stale or not present. | |
*/ | |
function getCachedValue(key, expirationInMinutes) { | |
Logger.log("getCachedValue(%s, %s)", key, expirationInMinutes.toFixed(0)); | |
var cache = PropertiesService.getScriptProperties(); |
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
#!/bin/bash | |
sink_name="bluez_sink.00_42_1B_AD_FA_CE" | |
if [ -z "$1" ]; then | |
dbus-monitor --system "path=/org/bluez/777/hci0/dev_00_42_1B_AD_FA_CE, interface=org.bluez.AudioSink, member=Connected" | while read line; do | |
echo $line | |
$0 1 | |
done | |
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
/** | |
* Source: https://gist.github.com/emmaly/2522d2e12157c4c3ebefe32d409ca996 | |
* | |
* @param {SpreadsheetApp.Range} ranges | |
* @returns {boolean} | |
* - `true` indicates all ranges share the same overlapping area with all others. | |
* - `false` indicates no shared overlap area, even if they all overlap individually. | |
*/ | |
function doRangesIntersect(...ranges) { | |
return getRangeIntersection(...ranges) !== null; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Glowy Floaty Balls</title> | |
<style> | |
body { | |
background-color: #222; |
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
{ | |
"meta": { | |
"id": "f803c041-7f48-48d0-852c-22adff386327", | |
"icon": { | |
"url": null, | |
"type": "URL" | |
}, | |
"description": "Converts Key/Value list to JSON", | |
"name": "KV to JSON" | |
}, |
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
None: | |
- none | |
True: | |
- boolean | |
False: | |
- boolean | |
65535: | |
- number | |
- integer | |
123: |
NewerOlder