This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS foobar ( | |
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | |
created_at TIMESTAMPTZ NOT NULL DEFAULT timezone('utc', now()), | |
updated_at TIMESTAMPTZ | |
); | |
CREATE OR REPLACE FUNCTION foobar_table_but() | |
RETURNS TRIGGER | |
LANGUAGE plpgsql | |
AS ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function factorial(num) { | |
if (num < 0) return -1; | |
else if (num === 0) return 1; | |
return num * factorial(num - 1); | |
} | |
export function allPossibleCombos(list, size) { | |
if (size > list.length) return []; | |
const results = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class API { | |
public static function fetchUser($userID) { | |
static $cache = []; | |
$url = "https://example.com/users"; | |
$method = "GET"; | |
if (isset($cache[$url][$method][$userID])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Comment: GPGTools - https://gpgtools.org | |
mQINBFrwuf0BEADF1LS3UCcPN4Jw0a/UWpKtqN31unqpoTGZ17hst/4Qqo7N/zeE | |
txpT/LBv13o2uQNEPen9s9HgwvnZI4JMh90Yvr53uSedI0qHKdHWF6JvG90JW702 | |
HySmDN2sZdXofB+Knk3OszQdgYpNBMTkulw+q3qAnUhkvyHe3mp/iFj3LO+U6ILV | |
CYlZ1Ds7HnVfKrLm0kBdaiVvKXySQ0O+J/vQZejdXLNa55CXWANUF1KhngcZO814 | |
cFtKgEJqzHCS+0NqetqLZ/NXLPiCuEDoK7cKAFqxj2kcXAsPF3JrXuMZqXNph7Bd | |
Y6mO70kv76XqUbZdPwTtSgRWS6LJPELNe4M9FCKZYbKwwRX8mH4EncLwgGmFEjaO | |
mZwwAcumHx8/tJV4sdopCEKqjI6VUL0teM92tKyZPXUafrJDpGd3uQxICeAp5xmG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Utility that waits for @predicate function to return truthy, testing at @interval until @timeout is reached. | |
* | |
* Example: await until(() => spy.called); | |
* | |
* @param {Function} predicate | |
* @param {Number} interval | |
* @param {Number} timeout | |
* | |
* @return {Promise} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Knex = require('knex'); | |
const { knexSnakeCaseMappers, Model } = require('objection'); | |
const uuid = require('uuid'); | |
const knex = Knex({ | |
client: 'pg', | |
connection: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add custom CSS rules here */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"home": { | |
"title": "Hello World!" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require('lodash'); | |
function camelCaseKeys(obj) { | |
return _.mapKeys(obj, (value, key) => { | |
return _.camelCase(key); | |
}); | |
} | |
_.mixin({camelCaseKeys}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const fs = require('fs'); | |
const JS_FILE = /^((?!(index)).)*\.js$/; | |
const JS_FILE_EXTENSION = /\.js$/; | |
fs.readdirSync(__dirname) | |
.filter(file => JS_FILE.test(file)) | |
.forEach(file => exports[file.replace(JS_FILE_EXTENSION, '')] = require(`./${file}`)); |