Skip to content

Instantly share code, notes, and snippets.

View Arathi's full-sized avatar

Arathi Arathi

View GitHub Profile
@Arathi
Arathi / Grid.tsx
Created January 16, 2024 16:40
简单的React Native网格系统
import React, { ReactNode } from 'react';
import { View, StyleSheet, StyleProp, ViewStyle } from "react-native";
type ViewStyleProp = StyleProp<ViewStyle>;
type Props = {
width: number;
gutter?: number;
style?: ViewStyleProp;
children?: ReactNode;
@Arathi
Arathi / Version.ts
Created November 30, 2023 02:19
版本号
const regexVersion = /(\d+)\.(\d+)(\.(\d+))?(-([0-9A-Za-z]+))?(\+([0-9A-Za-z]+))?/;
class Version {
major: number = 0;
minor: number = 0;
patch?: number;
preRelease?: string;
build?: string;
constructor(
@Arathi
Arathi / ProgressBar.vue
Created November 23, 2023 06:30
Vue3进度条
<script setup lang="ts">
import { computed } from 'vue';
interface Props {
min?: number;
max?: number;
value?: number;
height?: number;
}
@Arathi
Arathi / hacknet.js
Last active November 27, 2023 09:49
Bitburner Scripts
/** @type {NS} */
var ns;
async function writeToFile(id, results) {
const path = `/responses/${id}.txt`;
const content = JSON.stringify(results);
ns.write(path, content);
}
async function list() {
@Arathi
Arathi / AHdl.g4
Created October 22, 2023 17:05
Arathi Hardware Description Language
grammar AHdl;
// 语法
module: inputs outputs parts wires EOF;
inputs: INPUTS input (CM input)* CM ES;
outputs: OUTPUTS output (CM output)* CM ES;
@Arathi
Arathi / Mhdl.g4
Last active October 19, 2023 04:20
MHRD的ANTLR语法
grammar Mhdl;
component: inputSection outputSection partSection wireSection EOF;
inputSection
: INPUTS input (CM input)* SC
;
outputSection
: OUTPUTS output (CM output)* SC
@Arathi
Arathi / JsonRpc.kt
Created August 1, 2023 02:27
JSON-RPC报文结构
import com.fasterxml.jackson.annotation.JsonInclude
open class Request<P>(
/**
* A String specifying the version of the JSON-RPC protocol.
* MUST be exactly "2.0".
*/
val jsonrpc: String = Version20,
/**
@Arathi
Arathi / AHDL.g4
Last active June 7, 2023 09:32
AHDL语法定义
grammar AHDL;
ahdl
: (module)* EOF;
module
: MODULE moduleName LP EOL? portsDeclare RP LC actions RC EOL?
;
portsDeclare
@Arathi
Arathi / MHRD.g4
Last active June 6, 2023 09:24
MHRD语法
grammar MHRD;
component
: inputs outputs parts wires
;
inputs
: INPUTS_BEGIN portsDeclare eom
;
@Arathi
Arathi / grid.dart
Last active May 22, 2023 09:58
Flutter栅格系统
import 'package:flutter/widgets.dart' hide Row;
import 'package:get/get.dart';
import '../utils/reactive_units.dart';
enum JustifyContent {
start,
center,
end,
}