-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb_utils.py
More file actions
102 lines (93 loc) · 1.5 KB
/
web_utils.py
File metadata and controls
102 lines (93 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Web lib/utils.ts
web_utils = '''import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export interface Snippet {
id: string
title: string
code: string
language: string
tags: string[]
description: string
createdAt: string
updatedAt: string
}
export const LANGUAGES = [
'javascript',
'typescript',
'python',
'go',
'rust',
'java',
'cpp',
'c',
'csharp',
'php',
'ruby',
'swift',
'kotlin',
'sql',
'bash',
'powershell',
'html',
'css',
'scss',
'json',
'yaml',
'markdown',
'dockerfile',
'nginx',
'vim',
'lua',
'perl',
'r',
'dart',
'elixir',
'haskell',
'clojure',
'scala',
'groovy',
'julia',
'matlab',
'octave',
'pascal',
'delphi',
'fortran',
'cobol',
'erlang',
'ocaml',
'fsharp',
'scheme',
'racket',
'prolog',
'smalltalk',
'ada',
'lisp',
'basic',
'vbnet',
'apex',
'solidity',
'vyper',
'move',
'cairo',
'noir',
'circom',
'text'
] as const
export type Language = typeof LANGUAGES[number]
export function generateId(): string {
return Math.random().toString(36).substring(2, 15)
}
export function formatDate(dateString: string): string {
return new Date(dateString).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
}
'''
with open(f"{base_path}/packages/web/lib/utils.ts", "w") as f:
f.write(web_utils)
print("✅ Web utils.ts created")