Skip to content

Instantly share code, notes, and snippets.

@CVertex
CVertex / Google-Sheet-Form-Post.md
Created July 9, 2017 04:25 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Run example

You should be able to just open index.html in your browser and test locally.

However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000

@CVertex
CVertex / discriminated_union.ts
Created August 25, 2018 12:42
Discriminated Union TypeScript example using instanceof. It's nice for web APIs
class Video {
id: number;
constructor(id: number) {
this.id = id;
}
}
class Error {
message: string;
python -c 'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer(("127.0.0.1", 3027), shs.SimpleHTTPRequestHandler).serve_forever()'
@CVertex
CVertex / diff.py
Created November 21, 2018 23:59
Playing around with difflib module in python 2.7
import difflib
a = """
one
two
three
four
"""
b = """
import csv
import io
class CsvDownloadHandler(handlers.BaseAjaxHandler):
# TODO, POST instead of GET to avoid XSSI prefixes
def get(self):
self.response.headers['Content-Type'] = 'application/csv'
self.response.headers["Content-Disposition"] = 'attachment; filename="%s"' % 'all-sessions.csv'
/**
* https://stackoverflow.com/questions/37098405/javascript-queryselector-find-div-by-innertext
* https://developers.google.com/gsuite/add-ons/concepts/menus
* https://stackoverflow.com/questions/51848258/google-docs-programmatically-send-mouse-click-to-an-item-in-outline-pane
* https://stackoverflow.com/a/43331339/209
*
* */
var simulateMouseEvent = function(element, eventName, coordX, coordY) {
async function getLoggedInEmail() {
return new Promise((resolve, reject) => {
try {
// header element works on gmail
// .ongoogle-material-minibar works on slides UI
let header = document.querySelector('header');
if (header === null) {
// Try mini-bar
header = document.querySelector('.onegoogle-material-minibar')
let
Used to associate, or bind, a name to a value or function.
Error opening binary file 'C:\Program Files\dotnet\shared/Microsoft.NETCore.App\3.1.1\Microsoft.DiaSymReader.Native.amd64.dll': C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.1\Microsoft.DiaSymReader.Native.amd64.dll: bad cli header, rva 0F# Compiler(229)
Problem reading assembly 'C:\Program Files\dotnet\shared/Microsoft.NETCore.App\3.1.1\Microsoft.DiaSymReader.Native.amd64.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Program Files\dotnet\shared/Microsoft.NETCore.App\3.1.1\Microsoft.DiaSymReader.Native.amd64.dll': C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.1\Microsoft.DiaSymReader.Native.amd64.dll: bad cli header, rva 0)F# Compiler(3160)
Error opening binary file 'C:\Program Files\dotnet\shared/Microsoft.NETCore.App\3.1.1\api-ms-win-core-console-l1-1-0.dll': C:\Program Files\dotnet\shared\Microsof