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 { | |
| defineDocumentType, | |
| ComputedFields, | |
| makeSource | |
| } from 'contentlayer2/source-files'; | |
| import { writeFileSync } from 'fs'; | |
| import readingTime from 'reading-time'; | |
| import GithubSlugger from 'github-slugger'; | |
| import path from 'path'; | |
| // Remark packages |
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 asyncio | |
| import base64 | |
| import json | |
| import os | |
| import pyaudio | |
| from websockets.asyncio.client import connect | |
| class SimpleGeminiVoice: | |
| def __init__(self): |
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 client"; | |
| import { usePathname, useSearchParams } from "next/navigation"; | |
| import { useEffect } from "react"; | |
| import { usePostHog } from "posthog-js/react"; | |
| export default function PostHogPageView() { | |
| const pathname = usePathname(); | |
| const searchParams = useSearchParams(); | |
| const posthog = usePostHog(); |
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 NextAuth from "next-auth"; | |
| import type { NextApiRequest, NextApiResponse } from "next"; | |
| import { authOptions } from "@/lib/auth"; | |
| // try to avoid magic link protection from outlook | |
| export async function GET(Request: NextApiRequest, Response: NextApiResponse) { | |
| if (Request.method === "HEAD" || /lua-resty-http.+ngx_lua/.test(Request.headers["user-agent"])) { | |
| console.log("Bot detected"); | |
| return Response.status(200).end(); | |
| } |
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 completion = await openai.chat.completions.create({ | |
| model: azureId, | |
| temperature: 0.9, | |
| messages: [ | |
| { | |
| role: 'system', | |
| content: systemPrompt, | |
| }, | |
| { | |
| role: 'user', |
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
| <div className="mb-3 flex space-x-4"> | |
| {siteConfig.email && ( | |
| <a href={`mailto:${siteConfig.email}`}> | |
| <Button variant="ghost" size="icon" aria-label="Email"> | |
| <MailIcon className="w-6 h-6" /> | |
| </Button> | |
| </a> | |
| )} | |
| {siteConfig.github && ( |
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
| (function() { | |
| var aa = document.querySelectorAll("input[type=checkbox]"); | |
| for (var i = 0; i < aa.length; i++){ | |
| aa[i].checked = true; | |
| } | |
| })() |
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 fs = require('fs'); | |
| const path = require('path'); | |
| const folderPath = './blog2'; // Replace with the actual path to your folder | |
| fs.readdir(folderPath, (err, files) => { | |
| if (err) { | |
| console.error(err); | |
| return; | |
| } |
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 queryString = location.search; | |
| // parse the query string into an object of key-value pairs | |
| const urlParams = new URLSearchParams(queryString); | |
| // get the value of the "piwik pro" parameter | |
| const campaign = urlParams.get("pk_campaign"); | |
| // get piwik pro param or ref param | |
| const source = urlParams.get("pk_source") || urlParams.get("utm_source") || urlParams.get("ref"); | |
| const medium = urlParams.get("pk_medium"); | |
| // save the parameter value in state | |
| const urlParam = { campaign: campaign || "website", source: source || "website", medium: medium || "website" }; |
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
| name: Deploy to Web | |
| run-name: ${{ github.actor }} created a deployment. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |