Skip to content

Instantly share code, notes, and snippets.

@CodingDoug
CodingDoug / README.md
Last active December 14, 2022 09:48
Realtime Database triggers with Cloud Functions for Firebase - source

Realtime Database triggers with Cloud Functions for Firebase - source

This gist contains the source code in my video series about Realtime Database triggers. You can watch the three parts here:

  1. Part 1 (intro, onCreate)
  2. Part 2 (onUpdate, infinite loops)
  3. Part 3 (onDelete, transactions)

index.ts contains the Cloud Functions code, and dialog.ts contains the script to run

@cklanac
cklanac / shopping-list-api.md
Created November 16, 2016 22:25
Creating a Shopping List API

Creating a Shopping List API

In this lesson you will be using your Node.js and Express skills to create the back end for a simple Shopping List application. The application will allow users to add, read, update and remove shopping items. You'll learn about the CRUD model and RESTful APIs, then put this into practice when creating the back end.

Goals

  • Understand the basics of CRUD and REST
  • Create RESTful endpoints which perform all of the CRUD operations

Intro to REST and CRUD

@cklanac
cklanac / reveal-module.md
Last active December 21, 2017 22:59
Reveal Module Pattern

Reveal Module Pattern

A reveal module is an immediately-invoked function expression that returns an object who's methods have closure over the enclosing functions variable scope.

Breaking down the definition, there are 3 key aspects to reveal-module.

  1. The outer function is executed using a the IIFE syntax (...)();. This has the benefit of preventing any polution of the global scope with extra unnecessary varaibles.

  2. The outer function returns an object literal with functions as properties (methods). This is a factory that generates an object with methods (functions) and properties (variables).

  3. Those methods create a closure over the scope so the retain (read, remember) the scope where they were defined. This effectively creates private properties and methods.

@apolloclark
apolloclark / postgres cheatsheet.md
Last active March 7, 2024 13:53
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@JosefJezek
JosefJezek / the-10-commandments-of-modern-web-application.md
Last active June 12, 2020 03:39
The 10 Commandments of Modern Web Application
@cklanac
cklanac / Javascript OO Cheat Sheet
Last active September 14, 2022 09:35
Javascript OO Cheat Sheet
/***********************************************************************************************************************
***********************************************************************************************************************
* CONTENTS:
* Native Object
* Object Literal
* Basic Object
* Psuedo-Class
* Self Executing/Invoking Structure
* Lazy Function
* Module Pattern
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh