Skip to content

Instantly share code, notes, and snippets.

View chrisbrocklesby's full-sized avatar
💭
☕️

Chris Brocklesby chrisbrocklesby

💭
☕️
View GitHub Profile
@chrisbrocklesby
chrisbrocklesby / hbs-templating.js
Created March 17, 2024 01:15
Handler Bars File Based Templating Engine - HBS
import Handlebars from "handlebars";
import fs from "fs/promises";
// Check if the templates directory exists.
try {
await fs.access("./templates");
} catch (error) {
console.log("The templates directory does not exist.");
process.exit(1);
}
@chrisbrocklesby
chrisbrocklesby / docker-build-ssh-githubaction.md
Created October 17, 2022 21:54
Docker & SSH Deploy GitHub Actions
name: Deploy Image to Container

on:
  push:
    branches:
      - "main"

env:
  CONTAINER_NAME: template-starter-container
@chrisbrocklesby
chrisbrocklesby / postgresjsoncheatsheet.md
Created April 7, 2022 23:48
Postgres 14 JSON Cheat Sheet

Postgres JSON Cheat Cheat Sheet

Select

SELECT data['title'] as title FROM blogs WHERE data['author']['first_name'] = '"Ada"';

Insert

INSERT INTO blogs (data) VALUES ('{"title": "blog one", "author": {"first_name": "Ada", "last_name": "Love"}}' );
@chrisbrocklesby
chrisbrocklesby / MongoDB_Native.md
Created August 29, 2021 02:00
MongoDB Native Drive Example - (NodeJS / Export & Import / Await & Async)

MongoDB Native Drive Example

(NodeJS / Export & Import / Await & Async)

db.js

const mongodb = require('mongodb');

const url = 'CONNECTION_URL';
const options = {};
const database = 'DATABASE_NAME';

Setup Ubuntu Server

Update and Upgrade

sudo apt update && sudo apt upgrade

Setup unattended upgrades (Optional)

Below installs security updates only by default

@chrisbrocklesby
chrisbrocklesby / Serverless Cheatsheet.md
Created February 16, 2020 23:17
Serverless Framework Cheatsheet

Serverless Cheatsheet

Login

serverless login
sls login

Info

@chrisbrocklesby
chrisbrocklesby / JS Cheatsheet.md
Created January 1, 2020 06:12
Cheatsheet Javascript