Skip to content

Instantly share code, notes, and snippets.

View QQBoxy's full-sized avatar
🦄
Galloping!

QQBoxy

🦄
Galloping!
View GitHub Profile
@QQBoxy
QQBoxy / performance.js
Created November 29, 2022 07:04
前後端測時間效率
const { performance } = require('perf_hooks');
// 前端為 `window.performance`
// 後端為 `const { performance } = require('perf_hooks');`
const func = (n) => {
return ((1 + n) * n) / 2;
};
const start = performance.now();
func(1000000);
/*jshint node: true, esversion: 9 */
const mqtt = require('mqtt');
const client = mqtt.connect('mqtt://your_mqtt_server');
const audio = require('win-audio').speaker;
client.on('connect', () => {
client.subscribe('increase/volume/inTopic');
});
client.on('message', (topic, message) => {
#include <Servo.h>
Servo servo;
byte digit = 0; // 目前數字 0~9
byte buttonState = 0; // 按鈕狀態
byte lastButtonState = 0; // 按鈕最後狀態
byte speed = 90; // 速度
byte speedState = 10; // 速度段數,預設 10 靜止
byte speedDirection = 1; // 方向
<span style="font-family: MS Pゴシック">
―_ ./////      ///    ///  ///三三三三三≡≡≡≡≡≡/.==<br />
 ̄―/////―_  ///   ///  ///  /三三三三三≡≡≡≡ /Ο =<br />
  .///// ̄―二///―_///  ///  /// 三三三三三≡≡≡/ ====<br />
  /////      /// ̄―///二///_///〃〃 ヽ  ヽ.| ._____|0 ====<br />
. /////      ///    ///  ///―///〃〃  ヽ  ヽ| |///|======<br />
/////      ///    ///  ///  ///〃〃ヽ   ヽ  .| |///|======<br />
////三三三///三三///三///三///〃 .木 木 木 木 . | |///|======<br />
///      ///    ///_///―///〃〃木 木 木 木. _| |///|======<br />
//      ///_―///三三三== ̄ | __口_口_口_口/三三三|======<br />
const shortUrl32 = (url) => {
const _alphabet = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'; // 排除相似字 01OI // 共 32 個字
const _base = _alphabet.length - 1;
const hash = CryptoJS.MD5(url).toString();
const hashLen = hash.length;
let i = 0;
let j = 0;
let codes = [];
// 生成的 32 個位數,使用 8位數 x 4組 = 32 位數
for (i = 0; i < 4; i++) {
const defaultState = {
code: null,
data: null,
total: null,
};
const Regions = ({ ...props }) => {
const [{ code, data }, setState] = useState(defaultState);
useEffect(() => {
let canceled = false;
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema; // [20191110] For mariadb (By QQBoxy)
class AppServiceProvider extends ServiceProvider
{
/**
#天氣
get-appxpackage *BingWeather* | remove-appxpackage
#取得協助
get-appxpackage *GetHelp* | remove-appxpackage
#Microsoft 提示
get-appxpackage *Getstarted* | remove-appxpackage
#HEIF 擴充功能
get-appxpackage *HEIF* | remove-appxpackage
#Microsoft 訊息中心
get-appxpackage *Messaging* | remove-appxpackage
<div>
Input:
<br />
<textarea id="rowdata" cols="40" rows="10" onclick="select()"></textarea>
</div>
<div>
Output:
<br />
<textarea id="newdata" cols="40" rows="10" onclick="select()"></textarea>
</div>
@QQBoxy
QQBoxy / file.js
Last active October 29, 2018 06:56
/**************************************************
File: File.js
Name: File
Explain: File
****************************************By QQBoxy*/
/*jshint node: true, esversion: 6 */
'use strict';
import React from 'react';
import { Form, Button, Upload, Icon, DatePicker, message } from 'antd';