Skip to content

Instantly share code, notes, and snippets.

View mouyong's full-sized avatar
💭
I may be slow to respond.

= - = mouyong

💭
I may be slow to respond.
View GitHub Profile
@mouyong
mouyong / hls.sh
Created November 9, 2024 07:08 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
<template>
<VueMarkdownEditor
v-model="newModelValue"
:disabled-menus="[]"
:include-level="[1, 2, 3, 4, 5, 6]"
@upload-image="handleUploadImage"
@change="change"
:height="height + 'px'"
:placeholder="placeholder"
>
@mouyong
mouyong / README.md
Created October 9, 2020 04:51 — forked from Eotones/README.md
speechSynthesis強制使用Chrome中的Google小姐中文語音

speechSynthesis強制使用Chrome中的Google小姐中文語音

網路上的window.speechSynthesis教學主要都只有說切換指定語言

像是這樣就能切換成中文語音:

const synth = window.speechSynthesis;

const speak = (msg) => {
@mouyong
mouyong / file-upload-multipart.go
Created February 24, 2020 12:46 — forked from andrewmilson/file-upload-multipart.go
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@mouyong
mouyong / get_current_router_bind_key
Last active June 24, 2018 20:53
查看当前路由绑定中的参数名
// helpers.php
if (!function_exists('get_current_router_bind')) {
function get_current_router_bind_key() {
dd(key(array_reverse(last(last(debug_backtrace(0)[2])))));
}
}
// UserController
// update(Request $request, User get_current_router_bind_key())
public function update(Request $request, User $user)
@mouyong
mouyong / json.php
Last active June 25, 2017 04:28
转换 Ajax 响应的 json
function json($status, $data = null, $message = 'success')
{
if (is_null($data)) {
$data = ['status' => $status, 'message' => $message];
} elseif (is_string($data)) {
$data = ['status' => $status, 'message' => $data];
} else {
$data = ['status' => $status, 'message' => $message, 'data' => $data];
}
return json_encode($data);
@mouyong
mouyong / first_no_null.php
Last active June 25, 2017 04:17
php 7 以下 代替 ?? 运算符
## 代码
// 在 php 7 中,可以使用 ?? 运算符
// example:
// return $var ?? '';
function first_no_null(&$var, $default = '')
{
return !empty($var) ? $var : $default;
}
@mouyong
mouyong / baiduwaimai_sign.php
Created June 11, 2017 12:10
百度外卖 api v3 生成签名 PHP 版
/**
* 生成签名
*
* @param array $data
* @return string
*/
function gen_sign(array $data)
{
$arr = array();
$arr['body'] = $data['body'];
@mouyong
mouyong / ksort.js
Created June 11, 2017 11:59 — forked from stiekel/ksort.js
JavaScript ksort
function ksort(obj){
var keys = Object.keys(obj).sort()
, sortedObj = {};
for(var i in keys) {
sortedObj[keys[i]] = obj[keys[i]];
}
return sortedObj;
}