Skip to content

Instantly share code, notes, and snippets.

@piotrkulpinski
piotrkulpinski / gist:811281
Created February 4, 2011 16:12
Git commands
git remote prune origin - usuwa zdalnie usunięte branche
git reset --soft HEAD^ - cofa ostatnio wykonany commit
@piotrkulpinski
piotrkulpinski / .cleaninstall
Last active January 31, 2026 20:33
New macOS install script
#!/bin/sh
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install taps
brew tap homebrew/cask
# Install cli stuff
brew install git
@piotrkulpinski
piotrkulpinski / populate-form.js
Last active September 30, 2022 15:18
Pre-populating form based on the array stored in localStorage
const storageKey = 'storage'
const serializeArray = (elements, options) => {
const serializeData = []
const defaults = {
excludeTypes: ['password', 'hidden', 'submit'],
excludeNames: [],
}
const opts = Object.assign(defaults, options)
#!/bin/sh
echo "\033[4;33mUpdating Oh My Zsh…\033[0m"
omz update
echo "\033[4;33mUpdating global Homebrew packages…\033[0m"
brew upgrade --greedy
brew upgrade --cask --greedy
brew cleanup
#!/bin/bash
# ------------------------------------------------------------------------------
echo "\033[4;33mUpdating Oh My Zsh\033[0m"
omz update --unattended
# ------------------------------------------------------------------------------
@piotrkulpinski
piotrkulpinski / settings.json
Created January 3, 2024 08:35
VS Code Settings
{
// Window
"window.title": "${rootName}${separator}${activeEditorShort}",
"window.titleBarStyle": "custom",
"window.nativeTabs": true,
"window.commandCenter": false,
"workbench.colorTheme": "Default Dark+",
"workbench.iconTheme": "vs-tabler",
"workbench.sideBar.location": "right",
"workbench.editor.enablePreviewFromQuickOpen": true,
@piotrkulpinski
piotrkulpinski / api.generate-content.ts
Last active August 14, 2024 14:01
Generate product descriptions and relevant links using Anthropic API
import { createAnthropic } from "@ai-sdk/anthropic"
import Firecrawl from "@mendable/firecrawl-js"
import type { Tool } from "@prisma/client"
import { json } from "@remix-run/node"
import { generateObject } from "ai"
import { z } from "zod"
import { prisma } from "~/services.server/prisma"
const anthropic = createAnthropic()
const model = anthropic("claude-3-5-sonnet-20240620")
import Stripe from "stripe"
import { z } from "zod"
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? "", {
apiVersion: "2024-04-10",
})
export const stripeCheckoutSchema = z.object({
price: z.coerce.number(),
quantity: z.coerce.number(),
@piotrkulpinski
piotrkulpinski / component.tsx
Last active October 25, 2024 12:19
Northern Lights Component
import type { CSSProperties, HTMLAttributes } from "react"
import { cx } from "~/utils/cva"
export const NorthernLights = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => {
return (
<div
className={cx(
"fixed inset-x-0 top-0 z-50 flex h-32 flex-row items-center justify-center px-4 text-center bg-fd-background text-md gap-4 font-semibold pointer-events-none opacity-50",
className,
)}
import fs from "node:fs/promises"
import path from "node:path"
import { google } from "@ai-sdk/google"
import { getDomain, processBatchWithErrorHandling, sleep } from "@primoui/utils"
import { generateText, Output } from "ai"
import { z } from "zod"
import { env } from "~/env"
import { db } from "~/services/db"
const searchGoogle = async (query: string, retries = 3) => {