Skip to content

Instantly share code, notes, and snippets.

View lvxianchao's full-sized avatar
🎯
Focusing

星辰 lvxianchao

🎯
Focusing
View GitHub Profile
@lvxianchao
lvxianchao / LongToStringConfig.java
Created December 28, 2022 01:21
Java 将 Long 类型转换为 String 类型以解决前端精度丢失问题
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
import java.math.BigInteger;
@lvxianchao
lvxianchao / helpers.php
Created October 25, 2022 00:59
Laravel 辅助函数
<?php
if (!function_exists('json')) {
/**
* 返回统一接口响应
*
* @param bool $status
* @param int $code 状态码
* @param string $message 提示消息
* @param null $data 数据
#!/bin/bash
yum install -y
yum-config-manager --add-repo http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo
yum-config-manager --enable epel-apache-maven
yum install -y apache-maven
@lvxianchao
lvxianchao / isJson.js
Created March 2, 2022 00:20
JS 判断字符串是否是 JSON
function isJson(str) {
if (typeof str === 'string') {
try {
let obj = JSON.parse(str);
return !!(typeof obj === 'object' && obj);
} catch (e) {
return false;
}
}
@lvxianchao
lvxianchao / GithubAutoStar
Created July 22, 2020 02:40
一个根据给定的关键词自动在 Github 上 Star 仓库的命令行程序,基于 Laravel
<?php
namespace App\Console\Commands;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Console\Command;
class GithubAutoStar extends Command
{
@lvxianchao
lvxianchao / npm.taobao.sh
Last active June 19, 2024 08:32
设置 npm 和 yarn 的镜像源为淘宝镜像源
# ==========================================================
# NPM
# ==========================================================
npm set registry https://registry.npmmirror.com # 注册模块镜像
npm set disturl https://npmmirror.com/mirrors/node # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://registry.npmmirror.com/mirrors/electron/ # electron 二进制包镜像
@lvxianchao
lvxianchao / LoginBackground.vue
Last active October 11, 2019 02:59
Vue 组件 - 登录页面的 Canvas 动画背景(旋转星空)
<template>
<canvas id="canvas" width="100%" height="100%"></canvas>
</template>
<script>
export default {
name: "LoginBackground",
methods: {
canvas() {
let _this = this;