Skip to content

Instantly share code, notes, and snippets.

@clairefro
clairefro / app.js
Last active February 25, 2026 22:05
google apps script contact form submission handling
/* APPS SCRIPT */
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("inqueries");
var name = e.parameter.name.trim();
var email = e.parameter.email;
var phone = e.parameter.phone || ""; // Optional, may be empty
@clairefro
clairefro / Getting started with the Pieces VS Code extension.md
Created August 10, 2024 18:46
This code snippet creates an object called arrayToObj that takes an array as input. It then iterates through the array and assigns them to a new object with their id property of each element in it. Finally, it returns

Getting started with the Pieces VS Code extension

Preview:
const arrayToObj = <T extends { id: number }>(array: T[]): { [k: string]: T } => {
  const out: { [k: string]: T } = {};
  array.forEach((val) => {
    out[val.id] = val;
  });
  return out;
};
# Hugging FaceからのモデルをOllamaで実行する方法
## 参照:https://www.markhneedham.com/blog/2023/10/18/ollama-hugging-face-gguf-models
## Ollamaをゲット:https://ollama.com/download
# 1. hugging faceのCLIを取得
## pipの場合
pip install -U "huggingface_hub[cli]"
## pip3の場合は:pip3 install -U "huggingface_hub[cli]" 
@clairefro
clairefro / gas.js
Created March 22, 2024 16:45
Google Apps Script x Postman demo
function installTrigger() {
ScriptApp.newTrigger('onFormSubmit')
.forSpreadsheet(SpreadsheetApp.getActive())
.onFormSubmit()
.create();
}
const fakeSubmission = {"authMode":"FULL","namedValues":{"Your Name":["Claire"],"GitHub username":["clairefro"],"Timestamp":["9/20/2021 9:55:20"]},"range":{"columnEnd":3,"columnStart":1,"rowEnd":3,"rowStart":3},"source":{},"triggerUid":"3209236967361824985","values":["9/20/2021 9:55:20","Claire","clairefro"]}
function testSubmission() {

Proyecto de la Unidad 3: HTML, CSS, JavaScript

Agregar un "event listener" (escuchador de eventos) a un elemento HTML para cambiar el estilo CSS

index.html

  <div class="opening-screen">Tengo hambre</div>

  <button class="option-one-button">Dormir</button>
  <button class="option-two-button">Comer un sándwich</button>

Unit 3 Project: HTML, CSS, JavaScript

Adding an event listener to an HTML element to change CSS style

index.js

<div class="opening-screen">I am hungry</div>

<button class="option-one-button">Sleep</button>
@clairefro
clairefro / pm_flows_tracking_pixel_app_script.js
Last active June 13, 2023 22:11
pm_flows_tracking_pixel_app_script.js
/** Expects email to column to be first column of selected range */
/** Does not account for bounces */
function sendEmailsWithTrackingPixel() {
/** Update these values */
const POSTMAN_FLOW_WEBHOOK_URL = 'https://fooooooooooooooooooo.flow.pstmn.io'
const COL_SUBJECT = 3 // integer representing the absolute column number for email subject
const COL_BODY = 4 // integer representing the absolute column number for email body
const COL_ID = 5 // integer representing the absolute column number for placement of unqiue mail merge ID
const COL_STATUS = COL_ID + 1 // integer representing the absolute column number for mail merge status. Defaults to right of ID col
@clairefro
clairefro / roleassign-bot.js
Created November 20, 2021 18:09
roleassign-bot.js
require("dotenv").config();
const Discord = require("discord.js");
const DISCORD_STUDENT_EXPERT_ROLE_ID =
process.env.DISCORD_STUDENT_EXPERT_ROLE_ID;
const DISCORD_STUDENT_LEADER_ROLE_ID =
process.env.DISCORD_STUDENT_LEADER_ROLE_ID;
if (
!process.env.DISCORD_BOT_TOKEN ||
// Run this ONCE to install make the app listen for the form submission trigger
function installTrigger() {
ScriptApp.newTrigger('onFormSubmit')
.forSpreadsheet(SpreadsheetApp.getActive())
.onFormSubmit()
.create();
}
// Used for manual testing only. Simulates a real form submission
const fakeSubmission = {"authMode":"FULL","namedValues":{"Your Name":["Claire"],"GitHub username":["clairefro"],"Timestamp":["9/20/2021 9:55:20"]},"range":{"columnEnd":3,"columnStart":1,"rowEnd":3,"rowStart":3},"source":{},"triggerUid":"3209236967361824985","values":["9/20/2021 9:55:20","Claire","clairefro"]}
const testsPassedTemplate = `
<div class="container">
<h3>All tests passed! 🚀</h3>
<p>Congratulations! You've completed {{workshopCode}}. If you've registered for the classroom program, enter the <strong>same email you used in registration</strong> below to submit your progress to your teacher</p>
<form onsubmit="handleSubmit(event)">
<input type="email" name="email" placeholder="Enter your email" required />
<input type="submit" id="submit-button"/>
</form>
</div>