This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//## check in printing or not | |
let printing = false | |
const mediaQueryList = window.matchMedia('print'); | |
mediaQueryList.addListener(function (mql) { | |
if (mql.matches) { | |
console.log('onbeforeprint equivalent'); | |
printing = true; | |
} else { | |
console.log('onafterprint equivalent'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ref→[我該如何測量一個 DOM node](https://zh-hant.reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node) | |
*/ | |
/** 測量一個 DOM node | |
* 參考:[我該如何測量一個 DOM node](https://zh-hant.reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node) | |
*/ | |
export function useClientRect(): [DOMRect, (node: any) => void] { | |
const [rect, setRect] = useState<DOMRect>() | |
const [f_resize, setResizeFlag] = useState(true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { makeStyles} from '@material-ui/core' | |
const usePreStyles = makeStyles(({ palette }) => ({ | |
root: { | |
whiteSpace: 'break-spaces', | |
'&:hover': { | |
backgroundColor: palette.grey[100] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 範例: \<BR xsHide /> | |
*/ | |
import React from 'react' | |
import clsx from 'clsx' | |
import { withStyles } from '@material-ui/core/styles' | |
export const BR = withStyles(({ breakpoints }) => ({ | |
xsHide: { | |
[breakpoints.down('xs')]: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//======================================================== | |
/** | |
* Scroll Top FAB | |
* | |
* 範例: | |
* <ScrollTopFab /> | |
*/ | |
export function ScrollTopFab() { | |
const classes = useScrollTopFabStyles() | |
const trigger = useScrollTrigger({ threshold: 100 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useStyles = makeStyles(({ palette, zIndex }) => ({ | |
container: { | |
zIndex: `${zIndex.modal}!important` as any /* <-- 轉換成 any 弱型別 */ | |
}, | |
})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Path Traversal, 目錄瀏覽漏洞檢查。 | |
/// </summary> | |
/// <param name="fileName">檔案名稱</param> | |
public static string AntiPathTraversal(string fileName) | |
{ | |
/// 檢查是否往父層或子層目錄瀏灠。 ".." 或 "/xxx/yyy" | |
if (Regex.IsMatch(fileName, @"(\.\.)|(\/.+\/)|(\\.+\\)")) | |
throw new AppRCodeException(RCodes.InvalidData, "檔案名稱不合規定。"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// MySwal: 應用 | |
/// | |
import React, { useState } from 'react' | |
import * as MySwal from 'Widgets/MySwal' | |
export default function AppForm({ formProfile }) { | |
const [result, setResult] = useState(null) | |
return ( |