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 { betterAuth, logger } from "better-auth"; | |
import { | |
admin, | |
anonymous, | |
apiKey, | |
bearer, | |
captcha, | |
createAuthMiddleware, | |
emailOTP, | |
haveIBeenPwned, |
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
# Use a specific version of Node | |
FROM node:18-alpine AS base | |
ARG DATABASE_URL | |
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser | |
ENV DATABASE_URL=${DATABASE_URL} | |
# Set up environment for pnpm | |
ENV PNPM_HOME="/pnpm" | |
ENV PATH="$PNPM_HOME:$PATH" |
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
@Cron(CronExpression.EVERY_MINUTE) | |
async streakCronJob() { | |
const users = await prisma.user.findMany(); | |
for (const user of users) { | |
if (!user.timezone || !IANATimezones[user.timezone]) continue; | |
const userLocalTime = moment().tz(IANATimezones[user.timezone]); | |
// Fetch the last streak record | |
const lastStreakRecord = await prisma.streak.findFirst({ | |
where: { userId: user.id }, |
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 Nestjs filter which "filters" out all exceptions to add custom logging logic | |
import { Request, Response } from 'express'; | |
import { IncomingMessage } from 'http'; | |
import { | |
ArgumentsHost, | |
BadRequestException, | |
Catch, | |
ExceptionFilter, | |
HttpException, |
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 {randomBytes} from "crypto" | |
async createChat(userId: string, body: CreateChatDTO) { | |
const key = randomBytes(32).toString('base64'); | |
const iv = randomBytes(16).toString('base64'); | |
const chat = await prisma.chat.create({ | |
data: { | |
id: `ch_${createId()}`, | |
name: body.name, | |
topic: body.topic, |
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
String getErrorMessage(dynamic error, [String? message]) { | |
if (error is String) { | |
return error; | |
} else if (error is Map) { | |
if (error['message'] is List) { | |
return error['message'][0]; | |
} else { | |
return error['message']; | |
} | |
} else { |
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 jose from 'node-jose'; | |
const urlToGetLinkedInAccessToken = | |
'https://www.linkedin.com/oauth/v2/accessToken'; | |
export type LinkedInUser = { | |
iss: string; | |
aud: string; | |
iat: number; | |
exp: number; |
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 bottomBarActions = useMemo(() => { | |
const actions = [ | |
{ | |
name: "Home", | |
icon: ( | |
<Entypo | |
name="home" | |
size={24} | |
color={theme === "Dark" ? "#fff" : "#000"} | |
/> |
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
/// Get Balance of your account or another user | |
#[poise::command(slash_command, prefix_command)] | |
pub async fn balance( | |
ctx: Context<'_>, | |
#[description = "Selected user"] user: Option<User>, | |
) -> Result<(), Error> { | |
let u = user.as_ref().unwrap_or_else(|| ctx.author()); | |
ctx.defer().await.expect("Cannot defer"); | |
let client = ctx.data(); | |
let id = u.id.0.clone().to_string(); |
NewerOlder