This file contains hidden or 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
/** | |
* The function `usePseudoState` is a custom hook that allows for the creation of | |
* pseudo state variables in React. When `useState` becomes available, it should be | |
* applied to this object output by calling the `init` method with the `useState` | |
* function. | |
* | |
* The object returned from this function invocation | |
* | |
* @param initialValue - The `initialValue` parameter is the initial value that | |
* will be assigned to the pseudo state. |
This file contains hidden or 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
Object.assign(Object, { | |
validKey(value) { | |
return (typeof value === 'string' || typeof value === 'symbol') | |
}, | |
isObject(value) { | |
return value && (value instanceof Object || typeof value === 'object') | |
}, | |
/** |
This file contains hidden or 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
/** | |
* A simple Hasher implementation in JavaScript. This mimics the behavior of Swift's | |
* Hasher to some extent. It uses the djb2 algorithm for hashing. | |
*/ | |
class Hasher { | |
/** | |
* The constructor function takes in multiple values, flattens them into a single | |
* array, and then calls the combine method on each value. | |
* | |
* @param values - The "values" parameter is a rest parameter that allows you to |
This file contains hidden or 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
/** | |
* The Walker class provides a mechanism for iterating through a string and | |
* counting occurrences of specified opening and closing characters. It's designed | |
* to start counting when the first instance of the 'open' character is encountered | |
* and stops when the count drops back to zero. | |
* | |
* @example | |
* const walker = new Walker("{a{b}c}", {when: () => {}, searchFor: Walker.squigly}); | |
* walker.until(); // Process the string | |
* |
This file contains hidden or 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
globalThis.Descriptor = class Descriptor { | |
static base(enumerable = true, configurable = true) { | |
return { enumerable, configurable } | |
} | |
static data(value, writable = true, { configurable, writable } = this.base()) { | |
return { value, enumerable, configurable, writable } | |
} | |
static accessor( getter, setter, store, { configurable, writable } = this.base()) { |
This file contains hidden or 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
json () { | |
usage () { | |
echo "Usage: json [property] [file]" | |
echo " property: (optional) The property of the JSON object to retrieve." | |
echo " file: (optional) The file containing the JSON object. Defaults to 'package.json'." | |
echo "" | |
echo "Special values for property:" | |
echo " *: Retrieve the whole object." | |
echo " --help or -h: Display this help message." | |
} |
This file contains hidden or 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
// strnumconvert.c | |
#include <limits.h> | |
#include <ctype.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stddef.h> | |
#include "strnumconvert.h" |
This file contains hidden or 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
-- Drop existing trigger and function if they exist | |
DROP TRIGGER IF EXISTS trigger_before_insert_update_url_entry ON url_entries; | |
DROP FUNCTION IF EXISTS before_insert_url_entry(); | |
-- Drop the existing table if it exists | |
DROP TABLE IF EXISTS url_entries; | |
-- Create the new table | |
CREATE TABLE url_entries ( | |
id SERIAL PRIMARY KEY, |
This file contains hidden or 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
-- Drop the existing procedure if it exists | |
DROP PROCEDURE IF EXISTS SANDBOX_PRODUCT_ENGINEERING.CONTENT_OPTIMIZATION.insert_update_url_entry; | |
-- Create the new stored procedure | |
CREATE OR REPLACE PROCEDURE SANDBOX_PRODUCT_ENGINEERING.CONTENT_OPTIMIZATION.insert_update_url_entry( | |
p_id FLOAT, | |
p_href TEXT, | |
p_name VARCHAR) | |
RETURNS STRING | |
LANGUAGE JAVASCRIPT |
This file contains hidden or 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
# Replace shell with bash so we can source files | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections | |
RUN mkdir -p /usr/local/nvm | |
ENV NVM_DIR /usr/local/nvm | |
ENV NODE_VERSION 21.6.1 | |
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ | |
&& . $NVM_DIR/nvm.sh \ | |
&& nvm install $NODE_VERSION \ |