Skip to content

Instantly share code, notes, and snippets.

View ghostcode's full-sized avatar
🎯
Focusing

Zhuxy ghostcode

🎯
Focusing
View GitHub Profile
@ghostcode
ghostcode / ffmpeg.md
Created January 25, 2025 05:36 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
{
".123" : "application/vnd.lotus-1-2-3",
".3dml" : "text/vnd.in3d.3dml",
".3g2" : "video/3gpp2",
".3gp" : "video/3gpp",
".a" : "application/octet-stream",
".aab" : "application/x-authorware-bin",
".aac" : "audio/x-aac",
".aam" : "application/x-authorware-map",
".aas" : "application/x-authorware-seg",
@ghostcode
ghostcode / WebGL-WebGPU-frameworks-libraries.md
Created November 30, 2023 05:52 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries

Name Stars Last Commit Description
three.js ![GitHub Rep
@ghostcode
ghostcode / clipboard.js
Created October 17, 2023 04:04 — forked from viclafouch/clipboard.js
How to copy an image or a text to clipboard in Javascript (new way !) See https://copy-to-clipboard.now.sh/
// @return Promise<boolean>
async function askWritePermission() {
try {
// The clipboard-write permission is granted automatically to pages
// when they are the active tab. So it's not required, but it's more safe.
const { state } = await navigator.permissions.query({ name: 'clipboard-write' })
return state === 'granted'
} catch (error) {
// Browser compatibility / Security error (ONLY HTTPS) ...
return false
@ghostcode
ghostcode / get-latest-tag-on-git.sh
Created April 23, 2023 10:47 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@ghostcode
ghostcode / async&await.js
Created February 16, 2023 12:10
async&await 并行/串行優化
function getData() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(1)
},2000)
})
}
async function get() {
@ghostcode
ghostcode / uni-app表格组件
Created January 18, 2023 08:58
表格组件
‎‎​
@ghostcode
ghostcode / getPrecision.js
Last active January 12, 2023 05:57
获取精度
function getPrecision(value) {
const valueString = value.toString();
if (valueString.indexOf('e-') >= 0) {
return parseInt(valueString.slice(valueString.indexOf('e-') + 2), 10);
}
let precision = 0;
if (valueString.indexOf('.') >= 0) {
precision = valueString.length - valueString.indexOf('.') - 1;
}
return precision;
@ghostcode
ghostcode / throttle.md
Last active December 21, 2022 01:27
throttle
  function throttle(fn,wait=3000){
		let lastTime = Date.now(),
			timeFlag = null
			
		return function(...args){
			let current = Date.now()
			
			clearTimeout(timeFlag)
 
<!DOCTYPE HTML>
<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Zooming via HTML5 Canvas Context</title>
<style type="text/css" media="screen">
body { background:#eee; margin:1em; text-align:center; }
canvas { display:block; margin:1em auto; background:#fff; border:1px solid #ccc }
</style>
</head><body>