Add this to webstorm under Editor > Live Templates
Add a variable
TM_FILENAME_BASE -> capitalize(camelCase(fileNameWithoutExtension()))
| const express = require('express'); | |
| const schedule = require('node-schedule'); | |
| const { addMinutes, isValid, parseISO } = require('date-fns'); | |
| const bodyParser = require('body-parser'); | |
| const app = express(); | |
| app.use(bodyParser.json()); // for parsing application/json | |
| const port = 3000; |
The most recognized method to pinpoint a location. It uses:
Often employed in computer graphics and mathematics:
| // App.js | |
| import React from "react"; | |
| import { observer } from "mobx-react-lite"; | |
| import { counterStore } from "./store"; | |
| const App = observer(() => { | |
| return ( | |
| <div> | |
| <h1>{counterStore.count}</h1> | |
| <button onClick={() => counterStore.increment()}>Increment</button> |
| import { randomUUID } from "node:crypto"; | |
| import * as os from "os"; | |
| import Aigle from "aigle"; | |
| import { UtilityProcess, utilityProcess } from "electron"; | |
| import { compact, flatten, values } from "lodash"; | |
| import { z } from "zod"; | |
| import { trpc } from "../trpc"; | |
| type ServerEntry = { | |
| id: string; |
| import { RpcClient } from "./rpc.ts" | |
| import type { RpcAPI } from "./router.ts" | |
| export const client = new RpcClient<RpcAPI>(); | |
| const foo = rpcClient.get("foo"); | |
| foo.getFoo().then(console.log) |
Lua is known for being lightweight, embeddable, and flexible—and its approach to error handling is no different. Whether you're writing a game script, a plugin, or a CLI tool, understanding how Lua handles errors is essential for writing clean, maintainable code.
In this article, we'll explore:
error() vs returning nil, err| #!/usr/bin/env bash | |
| set -e | |
| echo "🔧 Updating system..." | |
| pacman -Syuu --noconfirm | |
| echo "📦 Installing dependencies..." | |
| pacman -S --noconfirm --needed mingw-w64-x86_64-lua51 mingw-w64-x86_64-gcc git make unzip zip tar gzip p7zip curl wget |
| .graph text { | |
| font-family: sans-serif; | |
| stroke: white; | |
| paint-order: stroke; | |
| stroke-width: 3; | |
| stroke-linecap: square; | |
| } |
| import { Box, render, Text, useStdout } from "ink"; | |
| import { useCallback, useEffect, useState } from "react"; | |
| import { debounceTime, filter, firstValueFrom, fromEvent, map } from "rxjs"; | |
| export function useScreenSize() { | |
| const { stdout } = useStdout(); | |
| const getSize = useCallback(() => ({ height: stdout.rows, width: stdout.columns }), [stdout]); | |
| const [size, setSize] = useState(getSize); |