Skip to content

Instantly share code, notes, and snippets.

View origin-coding's full-sized avatar
🇨🇳
What's happening?

OriginCoding origin-coding

🇨🇳
What's happening?
View GitHub Profile
@origin-coding
origin-coding / main.rs
Last active October 27, 2021 01:46
A pgsql connection example.
extern crate chrono;
extern crate postgres;
use chrono::prelude::*;
use postgres::{Client, NoTls};
fn main() {
// 连接数据库
let mut client = Client::connect(
"host=localhost user=postgres password=root dbname=Enrolled",
@origin-coding
origin-coding / VuelidateFormValidation.vue
Created August 2, 2022 12:38
An example using Vuelidate, with Vuejs 3, 'script setup' feature and Vuetify 3.
<template>
<v-container>
<v-form>
<v-row :no-gutters="true">
<v-col cols="3">
<v-text-field
:readonly="profile !== 'new'"
label="姓名"
variant="solo"
v-model="state.currentEmployee.name"
@origin-coding
origin-coding / main.ts
Created November 9, 2023 11:46
ip-address library turorial.
// IP-Address库使用教程配套代码
// 注:由于IPv6地址不太常用,本教程只讲述IPv4的部分,IPv6部分请自行查阅相关API。
import { Address4 } from "ip-address";
// 初始化
// 第一种:初始化IP地址和子网掩码
console.log("-----Initialization-----");
let address = new Address4("172.168.0.1/16");
console.log(
`Address1: address: ${address.address}, subnet mask: ${address.subnetMask}.`,