Skip to content

Instantly share code, notes, and snippets.

View FrankV01's full-sized avatar
🤚
Looking for OSS projects wanting help

Frank V FrankV01

🤚
Looking for OSS projects wanting help
View GitHub Profile
@FrankV01
FrankV01 / Docker-Compose-Reference.md
Created October 21, 2023 01:18
Docker Compose Reference

I intend to convert this to Markdown.

# --------------------------------------------------------------------------
# docker compose up -d  #Create & Start the stack and detach
# docker compose up --force-recreate --build -d #Create & Start the stack and detach
# docker compose down   #Stop and **Destroy** the stack (Does NOT remove the volume)
# docker compose down -v #Stop and **Destroy** the stack and **REMOVE** the volume
#
# docker compose stop  #Stop the stack. Does not destroy it.
# docker compose start # [re]start the stack.
@FrankV01
FrankV01 / Dockerfile
Created September 9, 2023 03:02 — forked from ju2wheels/Dockerfile
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.

Exercise 1

Revised Answer The correct SQL came to me last night. Here's my revised SQL. I left my original answer for completeness and disclosure (though you could see it from the history of the gist).

SELECT
     p.PersonId, p.NameFirst, p.NameLast,
     (select top 1 OrderId from Order o where o.PersonId=p.PersonId Order by OrderDateTime DESC) as LastOrderId,
     (select max(OrderDateTime) from Order o where o.PersonId=p.PersonId) as LastOrderDateTime
FROM Person p
ORDER BY p.PersonId DESC
//Sourced from https://github.com/TheOpenSourceU/pinkie/blob/tOSU/article/index.js#L170
function Promise(resolver) {
if (typeof resolver !== 'function') {
throw new TypeError('Promise resolver ' + resolver + ' is not a function');
}
if (this instanceof Promise === false) {
throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
}
@FrankV01
FrankV01 / tOSU-promises.js
Last active July 6, 2017 19:24
Convert tOSU-callback-hell.js to promise for article on http://theopensourceu.org/concepts-to-implementations-promise/
//
// require statements omitted for readability and brevity.
var readFile = Promise.promisify(require("fs").readFile); //See http://bluebirdjs.com/docs/api/promise.promisify.html
function processData( startData ) {
//Return a promise which impl will use "then" to implement what was "cbResult"
return new Promise( function(resolve) {
//
// Do something with startingData and ultimatly set result to finalizedResult.
// ...
client.query('SELECT NOW() as now', (err, res) => {
if (err) {
console.log(err.stack)
} else {
const targetDate = res.rows[0];
client.query(`SELECT * from myTable where lastCreated > ${res.rows[0]}`, (er2, res2) => {
//This, in theory could go on a bit. Note that this is a contrived example and in the case
// of SQL, you'd use the proper joins and conditionals in one statement.
})
}
// require statements omitted for readability and brevity.
function processData( startingData, cbResult ) {
//
// Do something with startingData and ultimatly set result to finalizedResult.
// ...
var finalizedResult = startingData;
cbResult(finalizedResult);
}
function parentMethod() {
findSomething(function(error, something) { //callback 1
if (error) {
throw new Error(error)
}
transformSomething(something, function(error, transformed) { //callback 2
if (error) {
throw new Error(error)
}
validateTransformed(transformed, function(error, validated) { //callback 3
if (error) {