Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs');
const axios = require('axios');
// Function to fetch all posts of a user
async function fetchUserPosts(instanceURL, accessToken, username) {
try {
const response = await axios.get(`${instanceURL}/api/v1/accounts/${username}/statuses`, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
@gr36
gr36 / .eleventy.js
Created February 17, 2024 15:11
This is the webmqntiosn filter and webventions partial for my 11ty blog
eleventyConfig.addFilter("countWebmentions", function(webmentionsFilePath, url) {
// Load and parse the webmentions JSON file
const data = JSON.parse(fs.readFileSync(webmentionsFilePath, 'utf8'));
// Filter webmentions based on the provided URL
const filteredWebmentions = data.children.filter(entry => {
return entry['like-of'] === url || entry['in-reply-to'] === url || entry['repost-of'] === url;
});
// Initialize counts for each type
// Add a date filter
eleventyConfig.addFilter("dateFormat", function(date) {
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2); // Adds leading 0 for single digit months
const day = ('0' + date.getDate()).slice(-2); // Adds leading 0 for single digit days
return `${year}/${month}/${day}`;
});
@gr36
gr36 / routes.yaml
Last active January 19, 2021 18:15
Routes
routes:
/rss/:
template: /rss/
content_type: text/xml
collections:
/:
permalink: /{slug}/
template: index
filter: tag:-[links,newsletter,notes,micro]
@gr36
gr36 / keybase.md
Created November 17, 2019 15:12
Keybase.md

Keybase proof

I hereby claim:

  • I am gr36 on github.
  • I am gr36 (https://keybase.io/gr36) on keybase.
  • I have a public key ASASCGNA3-ldd5rZ1wK4klg7menMZrR4oPp43EUS7G05vQo

To claim this, I am signing this object: