Skip to content

Instantly share code, notes, and snippets.

View jpvalery's full-sized avatar
🤓
Tinkering

Jp jpvalery

🤓
Tinkering
View GitHub Profile
@jpvalery
jpvalery / tz_shortlist.csv
Created April 10, 2023 21:26
A shortened list of timezones using the region format
name offset
Etc/GMT+12 −12:00
Pacific/Niue −11:00
Etc/GMT+11 −11:00
Pacific/Tahiti −10:00
Etc/GMT+10 −10:00
Pacific/Honolulu −10:00
Pacific/Marquesas −09:30
Etc/GMT+9 −09:00
America/Anchorage −09:00
@jpvalery
jpvalery / _api_folder_incoming.js
Last active October 7, 2023 08:59
How to do fire-and-forget requests in NextJS using middleware (Slack FaaS serverless ack() alternative)
// path /api/folder/incoming.js
export default async function handler(req, res) {
let message = `hi from /api/folder/incoming`;
console.log(message);
console.log(req.body)
res.status(200).send(message);
return;
}
@jpvalery
jpvalery / gsheet-appscript-collection-sync.js
Created July 27, 2021 11:23
A Google Sheet AppScript to sync the sheet with a Customer.io Collection
//Customer.io Collections Sync w/ Automated Sync
function updateCollection() {
var api_key = "[YOUR_APP_API_KEY]";
var collection_id = "[THE_COLLECTION_ID]";
var url = "https://beta-api.customer.io/v1/api/collections/" + collection_id;
var data = {
name: SpreadsheetApp.getActiveSheet().getName(),
url: SpreadsheetApp.getActiveSpreadsheet().getUrl(),
@jpvalery
jpvalery / first-day-next-month.liquid
Last active August 31, 2020 12:41
Looking to get the timestamp from the next first day of the month based on today? Here you go
{% comment %} assign initial variables {% endcomment %}
{% comment %} nowts = now timestamp / nowd = day of the month / nowm = number of the month / sd = seconds of a single day {% endcomment %}
{% assign nowts = 'now' | date: '%s' %}
{% assign nowd = 'now' | date: '%e' %}
{% assign nowm = 'now' | date: '%m' %}
{% assign nowy = 'now' | date: '%Y' %}
{% assign sd = 86400 %}
{% comment %} finding out how many days left in the month {% endcomment %}
{% comment %} dim = days in month / drm = days remaining in month {% endcomment %}