Skip to content

Instantly share code, notes, and snippets.

View MarcL's full-sized avatar
🤖
Automating all the things with n8n and AI

Marc Littlemore MarcL

🤖
Automating all the things with n8n and AI
View GitHub Profile
@MarcL
MarcL / deckchair-asia-cms-proposal.html
Last active July 14, 2026 08:48
Deckchair Asia CMS Proposal
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Headless CMS Platform — Deckchair Asia</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 860px; margin: 0 auto; padding: 2rem; color: #1a1a1a; line-height: 1.7; }
h1 { font-size: 2rem; border-bottom: 3px solid #0070f3; padding-bottom: 0.5rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.4rem; margin-top: 2.5rem; color: #0070f3; border-bottom: 1px solid #e0e0e0; padding-bottom: 0.25rem; }
@MarcL
MarcL / outlineDom.js
Created April 14, 2021 14:16
Outline DOM elements for debugging - run in your browser console
[].forEach.call($$("*"), function(element) {
element.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16);
});
@MarcL
MarcL / new_code.js
Created November 23, 2020 21:13
Code to send a Chatfuel message
// New way to import my library
const chatfuelBroadcast = require('chatfuel-broadcast');
app.post('/broadcast-to-chatfuel', (request, response) => {
const { body } = request;
const { userId } = request.body;
const botId = '<your-bot-id>';
const token = '<your-token>';
@MarcL
MarcL / prettyCode.js
Created November 14, 2020 11:56
Example code gist for my blog post on pretty code screenshots
function helpMe(question) {
return {
question,
response: 'Look here...',
url: 'https://marclittlemore.com/create-pretty-code-screenshots'
};
}
// Help me!
const answer = helpMe("How do I make pretty code screenshots?");
@MarcL
MarcL / serverlessHtmlRender.js
Created June 2, 2020 19:48
Renders an HTML file using a serverless function (Vercel in my case)
const { readFileSync } = require('fs');
const { join } = require('path');
const html = readFileSync(join(__dirname, './index.html'), 'utf8');
module.exports = (request, response) => {
response.send(html);
};
@MarcL
MarcL / nodeReverseProxy.conf
Created January 22, 2020 22:06
Reverse proxy configuration for nginx
server {
listen 80;
# Replace this with your domain
server_name www.mysite.com;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://localhost:8080;
@MarcL
MarcL / userAttributeSetting.json
Created January 21, 2020 20:06
Example of setting a Chatfuel user attribute in a JSON response
{
"set_attributes": {
"attribute1": "some data goes here",
"attribute2": "more data in here"
},
"messages": [{
"text": "A text message can go here if you like"
}]
}
@MarcL
MarcL / chatfuelAndMessengerGalleryWithQuickReplies.json
Created December 2, 2019 18:54
A Facebook Messenger response for Chatfuel showing a gallery with quick replies
{
"messages": [{
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [{
"title": "Welcome!",
"subtitle": "We have the right hat for everyone.",
"image_url": "https://petersfancybrownhats.com/company_image.png",
@MarcL
MarcL / FacebookButtonAdvert.json
Created November 21, 2019 20:47
Basic button template for a Facebook JSON advert for Messenger
{
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [{
"title": "Choose your car",
"buttons": [{
"type": "postback",
"title": "Mini",
@MarcL
MarcL / exampleJSONMessage.json
Created August 5, 2019 21:20
Example Facebook Ads Messenger response
{
"message": {
"text": "Hi there. Would you like to talk to my bot?",
"quick_replies": [{
"content_type": "text",
"title": "Yes please",
"payload": "Yes"
},
{
"content_type": "text",