Skip to content

Instantly share code, notes, and snippets.

View saiashirwad's full-sized avatar
🏠
Working from home

texoport saiashirwad

🏠
Working from home
View GitHub Profile
@saiashirwad
saiashirwad / .phoenix.js
Last active July 7, 2024 10:55
phoenix-stream-mode
const frame = Screen.main().visibleFrame();
const toggleStreaming = Key.on("s", ["control", "option"], () => {
const isStreaming = Storage.get("isStreaming") ?? false;
Storage.set("isStreaming", !isStreaming);
if (isStreaming) {
getAndMoveApp(
"Chatterino",
{ x: 0, y: 0 },
{ width: 250, height: frame.height },
import { FileSystem } from '@effect/platform';
import { NodeFileSystem, NodeRuntime } from '@effect/platform-node';
import * as Codegen from '@sinclair/typebox-codegen';
import { Console, Context, Effect, Layer, Ref, Stream, pipe } from 'effect';
import { compose } from 'effect/Function';
import { kebabToSnake, snakeToPascal } from 'effect/String';
import type { InternalRoute } from 'elysia';
import * as fs from 'node:fs/promises';
import ts from 'typescript';
import { elysiaRouter } from '~/elysia.router';
alt - h : yabai -m window --focus west
alt - j : yabai -m window --focus south
alt - k : yabai -m window --focus north
alt - l : yabai -m window --focus east
alt + shift - h : yabai -m window --swap west || $(yabai -m window --display west; yabai -m display --focus west)
alt + shift - j : yabai -m window --swap south || $(yabai -m window --display south; yabai -m display --focus south)
alt + shift - k : yabai -m window --swap north || $(yabai -m window --display north; yabai -m display --focus north)
alt + shift - l : yabai -m window --swap east || $(yabai -m window --display east; yabai -m display --focus east)
@saiashirwad
saiashirwad / nightmare-2.sql
Last active February 7, 2024 19:25
nightmare.sql
drop function if exists create_workflow(
name text, created_by varchar(24), workflow_type workflow_type, milestone_name text
);
create function create_workflow(name text, created_by varchar(24), workflow_type workflow_type, milestone_name text)
returns uuid
language plpgsql
as
$$
local utils = require("utils")
return {
{
"nvim-treesitter/nvim-treesitter",
init = function()
utils.lazy_load("nvim-treesitter")
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
type ControlledField<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
> = {
control: Control<TFieldValues>;
name: TName;
label?: string;
description?: string;
render: (props: {
field: ControllerRenderProps<TFieldValues, TName>;
export function optimisticallyUpdateArray<Data>(
condition: (data: Data) => boolean,
replacement: Data | ((data: Data) => Data),
) {
return (data: Data[] | undefined) => {
if (!data) return data
const index = data.findIndex(condition)
if (index === -1) return data
const newData = [...data]
newData.splice(
Plug 'kana/vim-textobj-entire'
set easymotion
set surround
set clipboard+=unnamed
set ideajoin
set multiple-cursors
set visualbell
let mapleader = " "
const createFormSchema = (
items: FormItem[],
): z.ZodObject<Record<string, never>> => {
const entries = items.map((formItem) => {
let schema = match<FormItem, z.ZodType>(formItem)
.with({ type: "DATE" }, () => z.date())
.with({ type: "NUMBER", data: { type: "NUMBER" } }, (item) => {
let schema = z.number();
if (item.data.min) {
schema = schema.min(item.data.min);
const threads = await ctx.db
.selectFrom("email")
.innerJoin("emailContact", "emailContact.emailId", "email.id")
.select([sql`max(timestamp)`.as("timestamp"), "threadId"])
.select(["emailContact.contactEmailId"])
.select((eb) =>
jsonObjectFrom(
eb
.selectFrom("email as e")
.select(allColumns(Columns.Email, "e"))