Updated version of the posted sql referenced in clone schema on the PostgreSQL wiki to work with PostgreSQL 15+.
SELECT clone_schema('public', 'pappyclone', TRUE);Updated version of the posted sql referenced in clone schema on the PostgreSQL wiki to work with PostgreSQL 15+.
SELECT clone_schema('public', 'pappyclone', TRUE);| // just using the module as the closure | |
| let count = 1; | |
| export function counter() { | |
| return count++; | |
| } |
It is as it sounds: this function will create something similar to an enum (in this case, an object with a null prototype) from a tuple of string literals.
Even though native enums have some convenient benefits, they can get a little "wordy" when you wish them to work like holders of string constants.
This will return the IPv4 or IPv6 address of the client making the GET request to the domain you specified when making
the CloudFront distribution. If you add an Accept header with application/json present, it will return an json-parseable
object like { "ip": "127.0.0.1" }, but if not specified or text/plain appears before application/json, it will
default to text/plain and just return the IP address like 127.0.0.1 (following standard handling of Accept headers).
I hereby claim:
To claim this, I am signing this object:
| var _toString = Object.prototype.toString; | |
| var _getPrototypeOf = Object.getPrototypeOf; | |
| function isPlainObject(value) { | |
| switch(value) { | |
| default: | |
| if (_toString.call(value) === '[object Object]') { | |
| break; | |
| } | |
| case null: |
| const complaints = Complaints.find({status: 'pending'}); | |
| // An object with keys of <Complaint.objectId> and values of {complaint<Complaint>, count<Number>} | |
| // Will dedupe complaints as well as track the number of times they appear. | |
| const complaintStore = complaints.reduce((complaintStore, complaint) => { | |
| if (complaintStore[complaint.objectId]) { | |
| // Already encountered this complaint, so just increment the counter | |
| complaintStore[complaint.objectId].count += 1; | |
| } else { | |
| // First time seeing this complaint, so initialize the container and store it |
How to determine if it should be active/inactive
| 'use strict'; | |
| const __ACTION_TYPE_NAME__ = Symbol('ActionType[__ACTION_TYPE_NAME__]'); | |
| const actionTypeSingletonStore = new Map(); | |
| export class ActionType { | |
| constructor(actionTypeName, ignoreActionTypeSingletonStore = false) { | |
| if (ignoreActionTypeSingletonStore === false) { |