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
{ | |
"channel": "#events", | |
"username": "TorontoJS EventBot™", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Events today*" | |
} |
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
const express = require("express"); | |
const PDF = require("pdfkit"); | |
const PizZip = require("pizzip"); | |
const Docxtemplater = require("docxtemplater"); | |
const fs = require("fs"); | |
const path = require("path"); | |
const server = express(); | |
server.get("/mypdf", async (req, res, next) => { |
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
import * as ics from "ics"; | |
import Discord, { GatewayIntentBits, REST, Routes } from "discord.js"; | |
import {Readable} from "stream"; | |
import moment from "moment"; | |
import { z } from "zod"; | |
const eventResponseSchema = z.object({ | |
id: z.string(), | |
name: z.string(), | |
description: z.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
const { readFile } = require("fs/promises"); | |
async function readRawInput(path) { | |
const content = await readFile(path, { encoding: "utf-8" }); | |
return content; | |
} | |
/** | |
* @param {string} fourCharacters ex "abcd" | |
* @returns true if all unique. false if there's a repeating character. | |
*/ |
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
const { readFile } = require("fs/promises"); | |
async function readRawInput() { | |
const path = "./input.txt"; | |
const content = await readFile(path, { encoding: "utf-8" }); | |
return content; | |
} | |
function parseLine(line) { | |
const pairs = line.split(","); | |
const firstPair = parseRangeString(pairs[0]); |
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
const { readFile } = require("fs/promises"); | |
function isUppercase(letter) { | |
return letter.toLowerCase() !== letter; | |
} | |
const alphaVal = (s) => s.toLowerCase().charCodeAt(0) - 97 + 1; | |
function letterToPriority(letter) { | |
return alphaVal(letter) + (isUppercase(letter) ? 26 : 0); |
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
export * from '@prisma/client'; | |
// 선택사항: 프리즈마 인스턴스를 여기에서 생성할 수도 있습니다. | |
import {PrismaClient} from '@prisma/client'; | |
export const prisma = new PrismaClient(); |
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
import {PrismaClient} from '@prisma/client'; | |
const prisma = new PrismaClient(); | |
// 자동으로 `Contact` 타입으로 유추됩니다. | |
const newContact = await prisma.contact.create({ | |
data: {email: '[email protected]'}, | |
}); |
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
datasource db { | |
url = env("DATABASE_URL") | |
provider = "postgresql" | |
} | |
generator client { | |
provider = "prisma-client-js" | |
} | |
model Contact { |
NewerOlder