Skip to content

Instantly share code, notes, and snippets.

View trezy's full-sized avatar
🥳

Trezy trezy

🥳
View GitHub Profile
{
"success": 1,
"code": "OK",
"msg": "OK",
"data": {
"rowcount": 1,
"totalrows": 1,
"estimatedrows": false,
"pagesize": 0,
"pagecount": null,
{
"success": 1,
"code": "OK",
"msg": "OK",
"data": {
"config": {
"nearPlane": 2,
"farPlane": 12345,
"stars": {
"useStarFading": true,
/**
* Add all items in an array of numbers.
*/
function addArray(array) {
return array.reduce((a, b) => a + b)
}
/**
* Calculate total stats (keyed by category), then generate
* additional meta stats based on initial calculations.
@trezy
trezy / reduceVersion1.js
Created June 21, 2022 16:02
Evaluating 2 versions of a JavaScript `array.reduce`
const valueArrays = [
[1, 2],
[100, 400, 700],
]
const TOTAL_COMBINATIONS = valueArrays
.reduce((accumulator, values, index) => {
if (index === 0) {
return values.length
}
@trezy
trezy / twinkle-twinkle-little-star.json
Created May 5, 2022 16:15
This is the first 4 bars of "Twinkle Twinkle Little Star" written in JSONg, which can be played with the emulator here: https://codepen.io/trezy/full/eYZGxXY
[
[
["C3"],
[4, "C2", "E2", "G2"]
],
[["C3"]],
[["G3"]],
[["G3"]],
[
// Module imports
import { MessageEmbed } from 'discord.js'
// Local imports
import { Command } from '../structures/Command.js'
import { fortunes } from '../../data/fortunes.js'
// Local imports
import {
client,
q,
} from './fauna.js'
Query(
Lambda(
["index"],
Get(
Select(
["data", Var("index")],
Paginate(Match(Index("fortuneRefs")), { size: 100000 })
)
)
)
Query(
Lambda(
["index"],
Let(
{
ref: Select(
["data", 0],
Paginate(Documents(Collection("Fortunes")), { size: 1 })
)
},
Query(Lambda(
[],
Count(
Documents(
Collection("Fortunes")
)
)
))