Skip to content

Instantly share code, notes, and snippets.

View sirius0486's full-sized avatar

sirius sirius0486

View GitHub Profile
{
// $0 — tab stop final cursor position
// $1, $2 for tab stops — tab stop to specify the cursor location and allow the user to customize the the name of the component
// ${1:label}, ${2:another} for placeholders.
// ${TM_FILENAME_BASE} — variable for getting the current filename
// \t
// /capitalize
// JS & TS import snippets
"Print to console": {
@sirius0486
sirius0486 / shortcut.md
Created September 4, 2023 11:17
Shortcut (Mac、VS Code、IDEA、Arc)

Mac

Mac 系统内置快捷键

Commands Usage Mean
Command + A 全选 Select All
Command + X 剪切 Cut
Command + C 复制 Copy
Command + V 粘贴 Paste
@sirius0486
sirius0486 / Powseshell_gitalias.ps1
Last active May 19, 2024 15:13
Powershell profile
function sw() {
git switch $args
}
function unresolve() {
git checkout --conflict=merge --
}
# temporarily ignoring files
function ignore() {
@sirius0486
sirius0486 / user-avatar.tsx
Created October 16, 2024 16:10
user-avatar.tsx
"use client"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card"
import { LogOut } from "lucide-react"
@sirius0486
sirius0486 / not-authorized.tsx
Last active October 18, 2024 07:27
route.ts
import Link from "next/link"
import { AlertCircle } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
@sirius0486
sirius0486 / page.tsx
Created October 24, 2024 08:38
500page
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { AlertTriangle } from "lucide-react"
import Link from "next/link"
export default function Custom500() {
return (
<div className="min-h-screen flex items-center justify-center bg-gray-100 dark:bg-gray-900">
<Card className="w-full max-w-md">
<CardHeader>
@sirius0486
sirius0486 / loading.tsx
Created November 4, 2024 06:00
loading.tsx
import { Loader2 } from "lucide-react"
import { Card, CardContent } from "@/components/ui/card"
export default function Loading() {
return (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm">
<Card className="w-[300px]">
<CardContent className="flex flex-col items-center justify-center p-6">
<Loader2 className="h-10 w-10 animate-spin text-primary" />
<p className="mt-4 text-lg font-semibold text-primary">Loading...</p>
@sirius0486
sirius0486 / maintenance.tsx
Last active November 25, 2024 03:37
maintenancePage
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
import { Button } from "@/components/ui/button"
import { Mail, Clock, AlertTriangle } from 'lucide-react'
export default function MaintenancePage() {
return (
<div className="min-h-screen bg-background flex items-center justify-center p-4">
<Card className="w-full max-w-lg">
<CardHeader>
@sirius0486
sirius0486 / package.json
Created December 3, 2024 01:32
package.json
{
"name": "admin-dashboard",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
@sirius0486
sirius0486 / api.tsx
Created January 20, 2025 15:44
useSWR snippet
// types.ts
export interface User {
id: string;
name: string;
email: string;
}
export interface Post {
id: string;
title: string;