Skip to content

Instantly share code, notes, and snippets.

/**
* This library includes software components derived from the following projects:
* [ChatGPTApp] (https://github.com/scriptit-fr/ChatGPTApp)
* [Google AI JavaScript SDK] (https://github.com/google/generative-ai-js/)
*
* These components are licensed under the Apache License 2.0.
* A copy of the license can be found in the LICENSE file.
*/
/**
@mhawksey
mhawksey / submit.md
Last active August 2, 2022 16:58 — forked from tanaikech/submit.md
Retrieving and Parsing XML data from Google Workspace Update Blog and Putting it to Google Spreadsheet using Google Apps Script

Retrieving and Parsing XML data from Google Workspace Update Blog and Putting it to Google Spreadsheet using Google Apps Script

This is a sample script for retrieving and parsing the XML data from Google Workspace Update Blog and putting it to Google Spreadsheet using Google Apps Script.

At Google Workspace Update Blog, the XML data is provided. By this, the retrieved XML data is parsed with XmlService, and the data is put to Google Spreadsheet. Recently, I got a request for this. So I created this sample script. When this was useful for your situation, I'm glad.

Update: Modified version of the script which keeps inserting new posts after the header row.

@mhawksey
mhawksey / Code.js
Last active June 14, 2022 05:32 — forked from erickoledadevrel/Code.js
Formatting date/time values using the user's timezone in Apps Script.
/**
* @file A sample showing how to format date/time values in Apps Script so that they appear in the
* user's timezone. View a working version here:
* https://docs.google.com/spreadsheets/d/1t_ur0wMw80AXaFkpBXmYclLfGm_kDccYcD5LAGoBkrQ/edit
*/
/**
* Add menu item after the spreadsheet opens.
*/
function onOpen() {
// @OnlyCurrentDoc
const BearerTokenKey = 'twitterBearerToken';
function onOpen() {
SpreadsheetApp
.getUi()
.createMenu('Twitter')
.addItem('Set Bearer token', 'helpers.requestBearerToken')
.addItem('Sign out', 'helpers.logout')
@mhawksey
mhawksey / Code.gs
Last active November 17, 2019 07:53 — forked from matthewrknoll/Code.gs
Automatically include your latest favorited Tweet in your Gmail signature. More info https://knoll.tech/2017/01/24/automatically-include-your-latest-tweet-in-your-gmail-signature/
// Grabs my latest tweet favorited using the handy TwtrService wrapper by +MartinHawksey - https://goo.gl/2it7yb
function getLatestTweet() {
var data = TwtrService.get("statuses/user_timeline", {screen_name: /*"YourTwitterHandle(without the @)"*/, count: 1});
var id = false;
for (var i = 0; i < data.length; i++){
if (data[i].favorited) {
id = data[i].id_str;
break;
}
}
@mhawksey
mhawksey / README.md
Last active December 25, 2015 04:49 — forked from mbostock/.block

The tree layout implements the Reingold-Tilford algorithm for efficient, tidy arrangement of layered nodes. The depth of nodes is computed by distance from the root, leading to a ragged appearance. Cartesian orientations are also supported. Implementation based on work by Jeff Heer and Jason Davies using Buchheim et al.'s linear-time variant of the Reingold-Tilford algorithm. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

@mhawksey
mhawksey / index.html
Created December 21, 2011 12:14 — forked from mbostock/.block
Dependency Chord Diagram (D3)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Chord Diagram</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.22.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.22.1"></script>
<style type="text/css">
body {
@mhawksey
mhawksey / googPlusFrFo-preliminarySketch.py
Created October 20, 2011 17:02 — forked from psychemedia/googPlusFrFo-preliminarySketch.py
First doodling around a Google Plus friends/followers network grapher
# ABOUT:
# A script that grabs a list of the friends or followers of one or more folk on Google+,
# grabs a sample of their friends, and generates the resulting social graph
# USAGE:
# Requirements: networkx (see DEPENDENCIES)
# Configuration: see CONFIGURATION
# Output: files will be save to the reports directory
# To run the script:
# 1) Download this file to a directory somewhere as eg googPlusFrFo-preliminarySketch.py
@mhawksey
mhawksey / index.html
Created October 13, 2011 20:45 — forked from yohman/index.html
Guardian Tag Explorer
<!DOCTYPE html>
<html>
<head>
<title>Guardian Tag Explorer</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.29.1"></script>
<link href='http://fonts.googleapis.com/css?family=Ubuntu:500' rel='stylesheet' type='text/css'>
<link href="http://jqueryui.com/themes/base/jquery.ui.all.css" type="text/css" rel="stylesheet" />