Skip to content

Instantly share code, notes, and snippets.

@Cauen
Cauen / code.ts
Last active May 3, 2024 17:39
Prisma Accent Case + Complex Query
// Raw Query
const getUnnacentPersonIdsByNameOrNickname = async (text?: string | null) => {
if (!text) return []
// Search accent case with View
const unnacentLower = (str: string) =>
str
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLocaleLowerCase()
const nameWhere = `unaccent(lower(name)) ilike '%${unnacentLower(
#pragma once
// Mira-VNext
#if MIRA_PLATFORM==MIRA_PLATFORM_ORBIS_BSD_1100
#include <mira/Kernel/Boot/Config.hpp>
/*
These are the required functions in order for the Oni Framework to operate properly
These are all offsets into the base of the kernel. They expect all standard FreeBSD 9 prototypes
The reason we do not hardcode offsets here, is due to the different platforms that are supported, and
@BenjaminArmstrong
BenjaminArmstrong / SaveVMBitmap.ps1
Last active May 3, 2024 17:33
Sample PowerShell script that shows you how to create a .BMP file of the display of a Hyper-V virtual machine.
$VMName = "VM 1"
$BMPName = "C:\Users\benja\Desktop\test.bmp"
Add-Type -AssemblyName "System.Drawing"
$VMCS = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_ComputerSystem -Filter "ElementName='$($VMName)'"
# Get the resolution of the screen at the moment
$video = $VMCS.GetRelated("Msvm_VideoHead")
$xResolution = $video.CurrentHorizontalResolution[0]
@rob-hills
rob-hills / ubuntu-22.04-mbp-a1707.md
Last active May 3, 2024 17:33
Ubuntu 22.04 on MacBook Pro 2017 (A1707, MBP 14,3)

Summary

Random set of notes and links that have helped me in the saga to get Ubuntu 22.04 up and running on my 2017 MacBook Pro These notes are mainly for myself in the event that I have to do this again some day. But if you find them helpful, that's great.

Important update

Unfortunately the MacBookPro that I bought second hand turned out to be a dud with some serious hardware flaws that didn't show up until a couple of months after I'd bought it.

I've since purhcased another laptop so I'm not going to be able to maintain this GIST.

I'll leave it here for now in case others want to contribute updates, or clone it. If you feel it's out of date or misleading or a waste of time, let me know in the comments and I'll remove it.

import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; //shadcn ui folder
const MAX_FILE_SIZE = 1024 * 1024 * 5;
const ACCEPTED_IMAGE_MIME_TYPES = [
"image/jpeg",
"image/jpg",
"image/png",
"image/webp",
];
@Klerith
Klerith / vite-testing-config.md
Last active May 3, 2024 17:33
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
@RabaDabaDoba
RabaDabaDoba / ANSI-color-codes.h
Last active May 3, 2024 17:33 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes working in C!
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@fnky
fnky / ANSI.md
Last active May 3, 2024 17:31
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
Open up browser console, for Chrome, hit F12 and copy-paste and enter this
$("a").filter(function(index){return $(this).text()==="unsave"}).click();setTimeout(function(){location.reload();},500);
Repeat until all items are unsaved.
@CaptainVincent
CaptainVincent / README.md
Last active May 3, 2024 17:28
Improve your vscode quickinput-widget

Customize your quickinput-widget

This is a small tool designed to emulate the Sublime style Command Palette as follows.

Screenshot

It requires the use of a specific extension to load the js file from this gist.

I'm using the APC extension, and the usage is as follows.