This file contains 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 fs from "fs-extra"; | |
const filePath = "midterm.txt"; | |
const fileContent = fs.readFileSync(filePath, "utf-8"); | |
const lines = fileContent.split("\n"); | |
let questionNumber = 1; | |
const updatedLines = lines.map((line) => { | |
const isQuestion = !( |
This file contains 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
<?php | |
require 'vendor/autoload.php'; | |
use Monolog\Logger; | |
use Monolog\Handler\StreamHandler; | |
$db = new PDO('sqlite:todo.db'); | |
$isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; |
This file contains 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
<?php | |
require 'vendor/autoload.php'; | |
use Monolog\Logger; | |
use Monolog\Handler\StreamHandler; | |
$isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; | |
// Create a log channel | |
$log = new Logger('todo'); |
This file contains 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
<?php | |
session_start(); | |
// Initialize the todo list | |
if (!isset($_SESSION['todos'])) { | |
$_SESSION['todos'] = []; | |
} | |
// Add a new todo item | |
if ($_SERVER["REQUEST_METHOD"] == "POST" && !empty($_POST['new_todo'])) { |
This file contains 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
/* wide */ | |
.wide .markdown-preview-sizer { | |
max-width: unset !important; | |
} | |
.life-calendar p a.internal-link { | |
display: inline-block; | |
} |
This file contains 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
/* section : font */ | |
@font-face { | |
font-family: "Geist"; | |
src: url(https://cdn.jsdelivr.net/gh/HananoshikaYomaru/geist@main/GeistVF.woff2) | |
format("woff"); | |
font-weight: normal; | |
} | |
@font-face { | |
font-family: "IA Writer Quattro"; |
This file contains 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
class Dedent { | |
dedent(templ) { | |
var values = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
values[_i - 1] = arguments[_i]; | |
} | |
var strings = Array.from(typeof templ === 'string' ? [templ] : templ); | |
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, ''); | |
var indentLengths = strings.reduce(function (arr, str) { | |
var matches = str.match(/\n([\t ]+|(?!\s).)/g); |
This file contains 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 { prisma } from "@princess/db"; | |
import pool from "@ricokahler/pool"; | |
import { type ResourceApiResponse, v2 } from "cloudinary"; | |
// this is the old cloudinary | |
const cloudName = "dg4lbnuii"; | |
const apiSecret = "e2L-_EHhcno3FLYZcHYbokaY-EU"; | |
const apiKey = "673961598382791"; | |
const newCloudNamePreview = "wemakeapp-preview"; |
This file contains 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
#!/bin/bash | |
# Define the list of branch names start with pr- | |
words=($(eas channel:list --json --non-interactive | jq -r ".currentPage[].name" | grep pr-)) | |
# Loop over the filtered words and run the commands | |
for word in "${words[@]}"; do | |
eas channel:delete $word --non-interactive | |
eas branch:delete $word --non-interactive | |
done |
This file contains 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 generateRandomString(length) { | |
let result = ""; | |
const characters = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
for (let i = 0; i < length; i++) { | |
result += characters.charAt(Math.floor(Math.random() * characters.length)); | |
} | |
return result; | |
} |
NewerOlder