Skip to content

Instantly share code, notes, and snippets.

@bennettscience
bennettscience / code.gs
Last active March 28, 2024 10:12
Custom course registration site with Google Apps Script
// ALL SERVER CODE RUNNING ON THE SPREADSHEET
// new property service GLOBAL
// see: https://developers.google.com/apps-script/reference/properties/
var SCRIPT_PROP = PropertiesService.getScriptProperties();
// Grab the correct spreadsheet
var sheet = SpreadsheetApp.openById("spreadsheetIdHere");
/**
@bennettscience
bennettscience / Code.gs
Created March 20, 2024 18:38
Automatically get a bit.ly link for a Google Form from a linked Google Sheet
// Copyright 2017 Brian E. Bennett
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@bennettscience
bennettscience / TBMod.md
Last active February 19, 2024 16:17
Tecmo Bowl modding instructions with links

Apparently, Tecmo Bowl is one of the most modded games ever. Much of this information is found on the tecmobowl.org forums, along with more software.

  1. Tecmo Bowl Team Manager

Tecmo Bowl is the simplest title. Tecmo Super Bowl got a little more complex, so the editor is more complex. Personally, as I was tinkering, I enjoyed replaying the original vs Tecmo Super Bowl, but that's just me. All things aside, you need an editor.

These programs allow you to load the game file (ROM, see below) and edit team names and rosters through a desktop app. If you're on a Mac and want to run Tecmo Bowl Manager, I can send more detailed instructions, because I got that running as well.

@bennettscience
bennettscience / onEdit.gs
Last active May 9, 2023 07:22
Dynamic data validation in Apps Script
function onEdit(e) {
var row = e.range.getRow();
var col = e.range.getColumn();
// If the edited column was 2 or 3, do the next part. Ignore other changes
if(col == 2 || col == 3) {
var value = sheet.getRange(row, col).getValue();
updateList(row,col, value);
}
}
@bennettscience
bennettscience / template.html
Last active April 13, 2023 14:46
Generates an HTML page based on form input data. This source should be hosted as a webpage.
<html>
<head>
<style type="text/css" media="screen"> <!-- Style the template -->
html,body {
margin:0;
padding:0;
}
p {
color:#8f8f8f;
font-family:Arial;
@bennettscience
bennettscience / PyRSS2Gen.py
Last active January 19, 2023 10:08
InstagramRSS - Follow your favorite public accounts from RSS feeds.
"""PyRSS2Gen - A Python library for generating RSS 2.0 feeds."""
""" Distributed under the BSD license here."""
__name__ = "PyRSS2Gen"
__version__ = (1, 1, 0)
__author__ = "Andrew Dalke <dalke@dalkescientific.com>"
_generator_name = __name__ + "-" + ".".join(map(str, __version__))
import datetime
@bennettscience
bennettscience / clearChildNotes.gs
Created January 15, 2019 19:32
Copy notes between Google Sheets
// If you make a mistake, this will clear all notes from the child sheets
function clearChildNotes() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet2');
var buildings = sheet.getRange(1, 1, sheet.getLastRow(), 3).getValues();
for(var i=0; i<buildings.length; i++) {
SpreadsheetApp.openByUrl(buildings[i][1]).getSheetByName('Sheet1').clearNotes();
}
}
@bennettscience
bennettscience / Code.gs
Created March 29, 2018 18:49
Event manager Apps Script webapp
var ss = SpreadsheetApp.getActiveSpreadsheet();
/**
* doGet - Return webapp
*
* @param {String} e query string to serve different pages
* @returns {String} rendered HTML to the browser
*/
function doGet(e) {
if (!e.parameter.page) {
@bennettscience
bennettscience / app.py
Last active June 21, 2022 12:36
An HTMX-based dynamic form system
# other flask stuff - this is just an example
# The actual application uses blueprints to keep routes organized.
from flask import Blueprint, Flask
app = Flask(__name__)
course_blueprint = Blueprint('courses', __name__)
app.register_blueprint(course_blueprint)
# Get the form to edit the event
@bennettscience
bennettscience / Form.svelte
Last active June 21, 2022 12:06
A Svelte form wrapper to dynamically load forms based on button click
<script>
/*
This is a generic wrapper component for any forms. Pass in an array of {field} objets to be
rendered into the form.
Submissions are all converted into JSON before being passed back to the parent for handling. This allows the
parent compoenent to determine the API route the form is submitting to rather than adding those options here.
*/
import Input from './formFields/Input.svelte';
import Select from './formFields/Select.svelte';