Skip to content

Instantly share code, notes, and snippets.

View ntnyq's full-sized avatar
🐣
Learning rust

ntnyq ntnyq

🐣
Learning rust
View GitHub Profile
@ntnyq
ntnyq / zrender-polygon.vue
Created March 28, 2024 08:47
zrender-polygon.vue
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import * as zrender from 'zrender'
import { ElMessage } from 'element-plus'
const renderRef = ref<HTMLDivElement>()
const start = () => {
if (!renderRef.value) return
const zr = zrender.init(renderRef.value, {
@ntnyq
ntnyq / run-command.ts
Last active March 13, 2023 17:36
Run command in root with execa
import path from 'node:path'
import { URL, fileURLToPath } from 'node:url'
import { $ } from 'execa'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
const rootPath = path.resolve(__dirname, '..')
const $$ = $({ cwd: rootPath, stdio: 'inherit' })
;(async () => {
await $$`prettier --write .`
@ntnyq
ntnyq / get-bilibili-follow-time.js
Last active March 5, 2023 16:40
get-bilibili-follow-time
;(async () => {
const getSpaceMid = () => location.pathname.split('/').at(1)
const spaceName = document.querySelector('#h-name').textContent
const style = `background: #42b883; color: #fff; font-size: 16px; padding: 10px 15px; border-radius: 4px; font-weight: 600;`
const mid = window._bili_space_mid ?? getSpaceMid()
let res = await fetch(`https://api.bilibili.com/x/space/acc/relation?mid=${mid}`, {
credentials: 'include',
})
res = await res.json()
const mtime = res?.data?.relation?.mtime
@ntnyq
ntnyq / how-to-find-forks-of-deleted-repo.md
Created November 8, 2021 01:41 — forked from rjeczalik/how-to-find-forks-of-deleted-repo.md
How to find forks of a deleted repository?
@ntnyq
ntnyq / mixin.scss
Created March 2, 2021 09:47
ASCII-only output with sass
// https://github.com/sass/sass/issues/659#issuecomment-71759457
@mixin variable-icon-font($icon-code) {
content: #{'\"\\'}#{$icon-code + '\"'};
}
.icon {
@include variable-icon-font(e603);
}
@ntnyq
ntnyq / qq.js
Created November 25, 2020 01:15
Connect with qq
const RE_MOBLE_DEVICE = /(iPhone|iPad|iPod|iOS|android)/i
const QQ_NUMBER = 123456
if (RE_MOBLE_DEVICE.test(navigator.userAgent)) {
window.open(
`mqqwpa://im/chat?chat_type=wpa&uin=${QQ_NUMBER}&version=1&src_type=web&web_src=http://wpa.b.qq.com`
)
} else {
window.open(
`http://wpa.qq.com/msgrd?v=3&uin=${QQ_NUMBER}&site=在线客服&menu=yes`
@ntnyq
ntnyq / 📊 Weekly development breakdown
Last active April 8, 2024 00:10
📊 Weekly development breakdown
Vue.js 11 hrs 1 min ███████████▌░░░░░░░░░ 55.2%
TypeScript 3 hrs 46 mins ███▉░░░░░░░░░░░░░░░░░ 18.9%
JavaScript 2 hrs 9 mins ██▎░░░░░░░░░░░░░░░░░░ 10.8%
JSON 1 hr 34 mins █▋░░░░░░░░░░░░░░░░░░░ 7.8%
Markdown 27 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.3%
@ntnyq
ntnyq / install.sh
Last active September 6, 2019 09:58
[About Python] #Python
$ brew install python
$ export PATH="/usr/local/opt/python/libexec/bin:$PATH"
@ntnyq
ntnyq / cache with closure
Last active April 23, 2020 06:32
[JavaScript Utils] #Utils
const cache = (() => {
const store = {}
return ({
set (key, value) {
store[key] = value
},
has (key) {
@ntnyq
ntnyq / ssh-config.sh
Last active September 6, 2019 09:58
[About VPS] #VPS
# Prodution no root login via ssh
vi /etc/ssh/sshd_config
PermitRootLogin no # change yes to no
service sshd restart