Skip to content

Instantly share code, notes, and snippets.

View Yagisanatode's full-sized avatar

Yagisanatode Yagisanatode

View GitHub Profile
@Yagisanatode
Yagisanatode / Index.html
Created December 28, 2023 04:48
For tutorial on CSRF in Google Apps Script for Yagisanatode blog
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body>
<div id="container">
<h1>Choose Your Goat</h1>
<form id="goatForm" onsubmit="event.preventDefault();">
@Yagisanatode
Yagisanatode / list_hidden_google_sheets.gs
Last active September 9, 2022 00:04
List hidden Google Sheets by name and id with Google Apps Script
/**
* @OnlyCurrentDoc
*/
/**
* Get a list of hidden or visible sheets.
* [The video tutorial]{@link https://youtu.be/jsTvi_F_Xk8}
* @author Scott (Yagi) <yagisanatode@gmail.com>
* @license Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
*/
@Yagisanatode
Yagisanatode / Code.gs
Last active November 3, 2021 09:23
Update Date-Time stamp on checkbox clicked in Google Sheets with Google Apps Script
// @author Yagisanatode @link https://www.yagisanatode.com
// Link to attached sheet. Go to File > Make a copy
// @link https://docs.google.com/spreadsheets/d/14orOMBnjpjHewUsWUgunZQKbeNNnZHM9JKMpkaCxRDA/edit#gid=0
// ####### on Edit trigger function #######
/**
* Custom Apps Script Trigger function that runs when sheet is edited.
* @param {Object} e - Apps Script trigger event object.
*/
function onEdit(e) {
@Yagisanatode
Yagisanatode / Index.html
Last active August 18, 2021 07:16
Added link to tutorial
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1 style="color:blue">You are worthy!</h1>
</body>
</html>
@Yagisanatode
Yagisanatode / code.gs
Created July 3, 2021 09:52
Get a Unique List of Objects in an Array of Object in JavaScript
/* Check out the link for the full tutorial and video guide
* {@link https://yagisanatode.com/2021/07/03/get-a-unique-list-of-objects-in-an-array-of-object-in-javascript/ |Get a Unique List of Objects in an Array of Object in JavaScript}
*/
const myObjArray = [
{
name: "Eva Devore",
character: "Evandra",
episodes: 15,
},
{
@Yagisanatode
Yagisanatode / Code.gs
Last active March 14, 2023 19:03
# AppsScript---Find-and-Replace-Text-With-a-link-in-Google-Docs Three examples on how to find text in a Google Doc and replace it with new text and a link with Google Apps Script's DocumentApp Class.
// Link to the tutorial: https://yagisanatode.com/2021/05/16/how-to-find-and-replace-text-in-a-google-doc-with-a-link-or-a-list-of-links-with-google-apps-script/
/**
* Find an replace text with a single link where there is no
* other text in the paragraph.
*/
function singleLink() {
// ## Inputs ##
let text = "My URL";
let url = "https://yagisanatode.com/";
@Yagisanatode
Yagisanatode / partition.py
Created May 29, 2015 09:32
Python - Finding an Item Between Two Characters In a String Using: partition and rpartition
'''
Finding an Item Between Two Characters In a String Using:
partition and rpartition
This could be handy for file creation and checking.
'''
file = 'batman(0).jpg'
file.partition('(')[-1].rpartition(')')[0]
'''
@Yagisanatode
Yagisanatode / WithOpen.py
Last active August 29, 2015 14:21
Python 3 - Opening files Using the "with" Statement
#! Python 3.4
### using the "with" statment to open a file###
"""Two ways to open a file"""
""" The old way """
file = open('example.txt', 'r')
read_file = file.read()
@Yagisanatode
Yagisanatode / NthNumberRangeLoop.py
Last active August 29, 2015 14:21
Python 3 - Use In For In Range Loop To Do Differently Occurring Tasks
#! Python 3
'''
Aim: To ping every fifth time in a count while
printing out the count 1 to 20
'''
count = 1
for i in range(0,4):
print ("ping")
@Yagisanatode
Yagisanatode / Tkinter_filedialog.py
Last active July 15, 2021 11:58
Python 3 - Open file dialog window in tkinter with filedialog
#! Python 3.4
"""
Open a file dialog window in tkinter using the filedialog method.
Tkinter has a prebuilt dialog window to access files.
This example is designed to show how you might use a file dialog askopenfilename
and use it in a program.
"""