Skip to content

Instantly share code, notes, and snippets.

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

Marc Littlemore MarcL

🤖
Automating all the things with n8n
View GitHub Profile
@MarcL
MarcL / phaser-speedup.md
Created March 10, 2017 09:19
Tips on speeding up Phaser games
@MarcL
MarcL / server.js
Created November 28, 2017 23:34
Node.js Code for Chatfuel Joke Bot - https://www.youtube.com/watch?v=oLFOy0f4AFQ
// server.js
// where your node app starts
// init project
var express = require('express');
var app = express();
var requestPromise = require('request-promise');
// we've started you off with Express,
// but feel free to use whatever libs or frameworks you'd like through `package.json`.
@MarcL
MarcL / server.js
Created January 16, 2018 09:08
Quick Node.js Express endpoint to redirect to a Messenger page
const express = require('express');
const app = express();
// Call this from JSON API like this:
//
// https://myserver.com/1920147214903175/GetEBook
//
app.get('/:fbpage/:reference', (request, response) => {
// Get the page and reference
// NOTE: There is no error checking here so it assumes that the parameters are always passed
@MarcL
MarcL / server.js
Last active January 16, 2018 10:23
Example of Node.js + Express server to parse url parameters and respond with Chatfuel text messages
const express = require('express');
const app = express();
// Call this from JSON API like this:
//
// https://myserver.com/united+states+of+america/12345
//
app.get('/:country/:productId', (request, response) => {
// Get the country and productId
@MarcL
MarcL / cryptocompare-express-server.js
Last active March 18, 2018 21:45
Express endpoint to perform CryptoCompare request and Chatfuel response
const express = require('express');
const app = express();
const requestPromise = require('request-promise');
// Call this from JSON API like this:
//
// https://myserver.com/crypto?fromCurrency=gbp&toCurrency=btc&amount=32.67
//
app.get('/crypto', (request, response) => {
// NOTE: There is no error checking for amount existing and from/to currencies being valid symbols
@MarcL
MarcL / README.md
Last active January 15, 2019 16:30
Move a BitBucket repository to GitHub

Move BitBucket repository to GitHub

As GitHub is now giving unlimited free private repositories to all users, you might want to move some of your private repositories to GitHub. Here's how you do it.

Create a new GitHub project

@MarcL
MarcL / README.md
Last active March 18, 2019 23:08
Angular semantic commit message types

Angular semantic commit message types

I keep forgetting what they mean so I'm adding them to a gist. Comes from the Angular repository.

Type

Must be one of the following:

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
@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",
@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 / 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",