Default value in Go’s method | | |
How to create new file using go script | | |
How to get the directory of the currently running file? | | |
How to add new methods to an existing type in Go? | | |
Rendering template.HTML directly into templates | | |
Stop goroutine execution on timeout | | |
What is the idiomatic Go equivalent of C’s ternary operator? | | |
★Golang Gin-Gonic Split Routes into Multiple Files - %userprofile%\AppData\Local\Temp\___go_build_*.exe - %userprofile%\AppData\Local\Temp\___TestDemo*.exe | | |
Go programs hanging on Windows 10 avast shut up | | |
(Go) How to use toml files? | | |
How to access struct fields in a template | | |
Simple if not working go template | | |
go-template error calling eq: invalid type for comparison in Go template | | |
Why does z-index not work? | | |
How to create jumbotron in Bootstrap 5? | | |
I want to align the text in a to the top | | |
Does Sass have a switch function? | | |
CSS - Equal Height Columns? | | |
How to ‘add watch’ in Chrome developer tools? | Ctrl+Shift+A | |
How to render/show images in HTML created on the fly with Golang and gin-gonic | data:image/png;base64,{{.}} | |
How to check whether a file or directory exists? | | |
Repository size limits for GitHub.com | 2021年,每個庫5GB以上開始有警告(建議最好在1GB下),最多不可超過100GB,單個檔案不可超過100MB | |
How to fix curl: (60) SSL certificate: Invalid certificate chain | curl -k -k or –insecure Allow insecure server connections when using SSL | |
Seeking a way to clone the issues for github projects | It is not possible to clone issues of GitHub repositories. | |
How can I delete my posted issue on GitHub? | Deleting an issue | |
Removing input background colour for Chrome autocomplete? | 更改autocomplete的顏色 | |
Where are the golang environment variables stored? | go env GOENV | |
How do I add Add text below font awesome icon Links? | | |
Access struct property by name | | |
★Using reflect, how do you set the value of a struct field? | | |
Can I target all tags with a single selector? | :is(h1, h2, h3, h4, h5, h6) {color: red;} is | |
How to make drop down on mouse hover | | |
SASS (not SCSS) syntax for css3 keyframe animation | | |
How do you serve a static html file using a go web server? | | |
How can I commit with no fast forward option (–no-ff) in SourceTree? | | |
How can I handle http requests of different methods to / in Go? | | |
In Go’s http package, how do I get the query string on a POST request? | http.Request.URL.Query()["param1"] | |
Make a line break when requesting user input (/P) in batch? | 可以在 /p 之前或之後使用echo | |
How to unmarshall viper config to struct with dash character | mapstructure | |
Unmarshaling nested JSON objects | | |
Split long commands in multiple lines through Windows batch file | | |
How to format current time using a yyyyMMddHHmmss format? | fmt.Println(t.Format("20060102150405")) | |
How to set default values in Go structs | | |
How to gracefully shutting down a golang server? | go1.8 http.Shutdown | |
How to change the current directory in Go | | |
Bcrypt password hashing in Golang (compatible with Node.js)? |  | |
Adding a favicon to a static HTML page | <link href="data:image/x-icon;base64,YourBase64StringHere" rel="icon" type="image/x-icon" /> | |
Range over string slice in golang template | https://golang.org/pkg/text/template/ | |
Embed javascript as base64 | | |
How can I read a whole file into a string variable | io.ReadAll | |
Include js file in Go template | | |
Correct way of getting Client’s IP Addresses from http.Request | | |
Enable CORS in Golang | | |
Difference between id and name attributes in HTML | The name attribute is used when sending data in a form submission. Different controls respond differently. For example, you may have several radio buttons with different id attributes, but the same name. | |
Gorilla mux custom middleware | | |
How to redirect to a url | http.Redirect(w, r, "/login/", http.StatusSeeOther) http.StatusSeeOther 303 這個是關鍵! | |
Golang Gorilla mux with http.FileServer returning 404 | | |
How can I get the user’s AppData folder path | 🐬 | |
Golang FileServer with custom css | | |
Is there any way to access private fields of a struct from another package? | reflect.ValueOf(*f).FieldByName("y") | |
How to serve up a JSON response using Go? | json.NewEncoder(w).Encode(goObj) | |
Static Data Grid - 10K records with search, pagination, export options | | |
How to insert and update data in Bootstrap table? | | |
What is the difference between jQuery’s mouseout() and mouseleave()? | | |
How to bind an event listener only once in pure JavaScript? | | |
How can I add an event for a one time click to a function? | EventTarget.addEventListener("click", function() { }, {once : true}); | |
Including image in Wenhixin bootstrap-table | | |
Table fixed header and scrollable body | thead, tbody tr {display: table; width: 100%; table-layout: fixed;} tbody {display: block; overflow-y: auto; table-layout: fixed; max-height: 768px;} | |
.tableExport is not a function | 確保載入的順序和此 網站 是一樣的 | |
Add “contenteditable” attribute to element using Javascript? | elemText.contentEditable = "true"; or elemText.setAttribute("contenteditable", "true"); | |
How can I get the corresponding table header (th) from a table cell (td)? | | |
wait till bootstrapTable is fully loaded before doing something | | |
error parsing regexp: invalid or unsupported Perl syntax: `(?!` | https://github.com/google/re2/wiki/Syntax
| |
Negate match in RE2 syntax? | | |
Golang: find string in file and show line number | | |
How to negate specific word in regex? | | |
How to filter issues on GitHub by issue id? | issue: 339, 310, 2 | |
How to use Checkbox inside Select Option | https://github.com/wenzhixin/multiple-select https://multiple-select.wenzhixin.net.cn/docs/en/download https://multiple-select.wenzhixin.net.cn/docs/en/usage | |
Converting HTML string into DOM elements? | var doc = new DOMParser().parseFromString(xmlString, "text/xml");
doc.firstChild.innerHTML | |
Add icon tray on Windows using native Golang API | | |
No data sources are configured to run this SQL | View -> Tool Windows -> Database | |
Convert array to slice in Go | myArray[:] | |
Go HTTP Post and use Cookies | | |
Open file dialog box in JavaScript | <input type="file" id="file-input"/> 可以把 #file-input {display: none;} 把請選擇檔案 隱藏起來 | |
★Golang GET multipart form-data | | |
Postman Chrome: What is the difference between form-data, x-www-form-urlencoded and raw | | |
How to send multipart/form-data form content by ajax (no jquery)? | | |
Need a basename function in Javascript | | |
How can you encode a string to Base64 in JavaScript? | | |
In Go, is there similar feature like “f-string” in Python? | | |
In-memory file for testing | | |
What’s the best way to reload / refresh an iframe? | | |
javascript xhr load iframe in response | | |
Remove all child elements of a DOM node in JavaScript | 解一: div.querySelectorAll('*').forEach(node => node.remove()) 解二: while (parent.firstChild) {parent.firstChild.remove()} | |
Selecting an element in iFrame jQuery | | |
Get element from within an iFrame | iframe.contentWindow.document.getElementsByTagName("H1")[0] | |
Access a variable of iframe from parent | document.getElementById("iframeid").contentWindow.a | |
JS map return object | myArray.map(e=>({field: e, title: e})) | |
“Uncaught SyntaxError: Cannot use import statement outside a module” when importing ECMAScript 6 | 要補上type=“module” <script defer type="module" src="/static/js/file/file.js"></script> | |
Set type for function parameters? | https://jsdoc.app/#block-tags | |
Reading file contents on the client-side in javascript in various browsers | | |
Push to GitHub without a password using ssh-key | | |
How to read data From *.CSV file using javascript? | | |
Is it possible to add dynamically named properties to JavaScript object? | (obj = {}, obj[field] = 123, obj) | |
Is it possible to dynamically load Go code? | - https://golang.org/pkg/os/exec/#example_Cmd_Run - https://golang.org/pkg/plugin/ | |
Load package dynamically (GO) | https://mojotv.cn/go/golang-plugin-tutorial | |
How do you add Bootstrap buttons in Bootstrap Table | | |
Trim string’s suffix or extension? | strings.TrimSuffix(basename, filepath.Ext(basename)) | |
How can I reference a commit in an issue comment on GitHub? | | |
How do I (succinctly) remove the first element from a slice in Go? | queue: x, a = a[0], a[1:] stack: x, a = a[len(a)-1], a[:len(a)-1] push: a = append(a, x) | |
error: template: “…” is an incomplete or empty template | | |
fonttools convert ttf to woff2 | 使用套件 from fontTools.ttLib import TTFont 來完成,試過ttf轉woff或woff2都可以完成。 或者直接使用指令 python -c "from fontTools.ttLib import TTFont; f = TTFont('path/to/your/file.otf');f.flavor='woff2';f.save('path/to/your/file.woff2')" | |
how to load m4a file in python | from pydub import AudioSegment audio = AudioSegment.from_file('file.m4a') | |
document.createElement(‘div’) with a class | myBtn.className = "btn" | |
Append multiple items in JavaScript | foo.append(bar1, bar2, bar3) | |
Font Awesome icon in select option | | |
text-align: right on or | select之中有一個dir停靠的位置可以設定,rtl可以靠右 <select dir="rtl"> | |
Async/Await Class Constructor | constructor() {return (async () => {this.value = await asyncFunction(); return this;})();} | |
Why TrimLeft doesn’t work as expected? | strings.TrimPrefix | |
Structs in Javascript | function StaticInfo(url) { this.url = url} | |
Is there an onSelect event or equivalent for HTML ? | | |
Font-Face changing via JavaScript | https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace#example , 記得最後一定要document.fonts.add(font) 才可以,如果是iframe,則是 iframeNode.contentWindow.document.fonts.add(font) | |
Are dashes allowed in javascript property names? | key名稱如果有奇怪的符號可以用雙引號包起來 {"font-family": "myfont"} | |
How to create an array containing 1…N | let N=10, i=0, a=Array(N); while(i<N) a[i++]=i; | |
Downsizing an .OTF font by removing glyphs | | |
How to disable all div content | <fieldset disabled><legend></legend><div></div></fieldset> | |
How to add an array of values to a Set | new Set([1,2,3,4]) [1,2,3,4].forEach(mySet.add, mySet) | |
Named capturing groups in JavaScript regex? | const { groups: { token } } = /(?<token>[^ $]*)/.exec(auth) | |
Can I use a regular expression in querySelectorAll? | (document.querySelectorAll('div')).filter(function(el){ return el.className.match(/^foo/i);} document.querySelectorAll('div[class^="foo" i]') | |
How to replace DOM element in place using Javascript? | targetNode.replaceWith(newNode) | |
Replace element contents with document fragment javascript | range.selectNodeContents(myNode), myNode.remove(), range.insertNode(frag) | |
Uncaught DOMException: Failed to read the ‘cssRules’ property | crossorigin="anonymous" | |
Why doesn’t document.addEventListener(‘load’, function) work in a greasemonkey script? | window.addEventListener() | |
Checking if a key exists in a JavaScript object? | undefined ?? "default value" options.person?.age ?? "" Optional_chaining (?.) | |
Regex to match string containing two (or more) words in any order and case not sensitive | ``(?i:os | path)`` (): 一個匿名group i: 不區分大小寫 |
Display image from http response with image content type | | |
Requesting blob images and transforming to base64 with fetch API | | |
Service worker registration failed. Chrome extension | "minimum_chrome_version": 93, | |
chrome.tabs.executeScript: Cannot access a chrome:// URL | 基於安全性的考量,chrome不允許您變更他的主題內容,你可以試試其他的頁面 | |
ReferenceError: “alert” is not defined | alert並非javascript的一部分,它屬於window的Object | |
google chrome extension :: console.log() from background page? | | |
JavaScript window.open returns null sometimes | 因為安全性的關係,取消了直接window.open的動作,但你可以改在點擊某個按鈕後觸發,例如: button.onclick = () => {window.open('https://javascript.info')} | |
JsPDF - Not allowed to navigate top frame to data URL | | |
Tainted canvases may not be exported | img.crossOrigin="anonymous" | |
Does JavaScript have the interface type (such as Java’s ‘interface’)? | Object.defineProperty | |
How to check if two arrays are equal with JavaScript? | JSON.stringify(a1)==JSON.stringify(a2) 缺點是null的比較會出問題 | |
Skip arguments in a JavaScript function | const {a = 10, b = 5} = {a: 3} Destructuring assignment | |
HTML5 Canvas set z-index | globalcompositeoperation w3school: globalcompositeoperation | |
setting background image to dynamic svg data? | element.style.backgroundImage = "url(data:image/svg+xml;utf8," + svgCode + ")"; | |
Drawing a grid on canvas | 可以先moveTo和lineTo,全部弄完了之後再使用stroke即可 | |
Get width/height of SVG element | node.getBoundingClientRect() | |
How to fill the whole canvas with specific color? | ctx.fillRect(0, 0, canvas.width, canvas.height); | |
Download data URL file | 可以創建a來達成,參考 而如果有必要href還有src都可以使用dataURI | |
How to create and export svg to png/jpeg in golang | | |
Capture HTML Canvas as gif/jpg/png/pdf? | | |
Drawing an SVG file on a HTML5 canvas | | |
What’s the most elegant way to cap a number to a segment? | clamp | |
Simulation background-size: cover in canvas | drawImageProp.js | |
Unable to trigger chrome.browserAction.onClicked.addListener with google chrome extensions | 在manifest.json.action.default_popup 有新增的情況下 chrome.browserAction.onClicked.addListener 會不起作用,您直接把裏頭的內容寫在service_worker.js之中即可 | |
What’s the best way to query an array in javascript to get just the items from it I want? | 全部myArray.filter , 單個myArray.find | |
Pop-Up Window, Center Screen | | Chrome-Extension |
Prevent HTML5 video from being downloaded (right-click saved)? | 如果您的server是使用Apache那麼您可以用.htaccess 的檔案來輔助您,來限制使用者的訪問權限,當然這種事golang也可以輕鬆做到。剩下的就是把影片鑲嵌到canvas之中 | |
Resize image with javascript canvas (smoothly) | ctx.imageSmoothingQuality = "low", "medium", "high" DOC | js |
What is the JavaScript version of sleep()? | sleep: 5 sec: await new Promise(resolve => setTimeout(resolve, 5000)) | js |
ES6 import error handling | import("/modules/my-module.js").then().catch() | js |
What is a blob URL and why it is used? | | js |
How do we download a blob url video | | js , youtube-dl |
How do you remove a method from a javascript type | delete myObj.prototype.foo | js |
Display browser console in HTML page | 從載 window.console 的方法即可 | js |
Display Git diff on client side in javascript as html | | git , js |
Make AudioBufferSourceNode the audio source of an tag? | | js |
Convert HTML5 Canvas Sequence to a Video File | | js |
Switch current tab from notification in Google Chrome extension | chrome.tabs.update(tabId, {highlighted: true}) | google-chrome-extension |
How do I delete an extension in my Chrome developer dashboard? | | google-chrome-extension |
JavaScript set object key by variable | { [yourKeyVariable]: someValueArray } | js |
Cannot create DocumentFragment storing td, tr or th? | 就是很奇怪td,th這類的不能這樣用。乖乖的用document.createElement再慢慢的添加到指定的節點去 | js |
How to specify max-height css property to Screen size | .scrollDiv {max-height: 100vh;overflow: auto;} | js |
How to execute an arithmetic operation inside a string in Javascript? | eval | js |
How to sort strings in JavaScript | item1.attr.localeCompare(item2.attr) | js |
How to get value of selected radio button? | document.querySelector(`input[type="radio"][name="algorithm"]:checked`).value; | js |
Why am I getting “Failed to load extension. Invalid value for ‘content_security_policy’”? | "content_security_policy": {"extension_pages": "script-src 'self'; object-src 'self'"} | google-chrome-extension |
Equation (expression) parser with precedence? | 不使用eval進行四則運算 | js |
access object property from object method in javascript | this相關 | js |
Sorting object property by values | Object.entries(obj).sort((a, b) => a[1] - b[1]) | js |
What is the difference between String.slice and String.substring? | 不要使用substr | js |
checking for typeof error in JS | 用 instanceof 來確認 | js |
How to close the current extension tab? | chrome.tabs.remove(tab.id, function() { }); | google-chrome-extension |
chrome.scripting.executeScript not working in my manifest v3 Chrome Extension | google-chrome-extension | |
Chrome extension: How to open a link in new tab? | chrome.tabs.create({ url: newURL }); | google-chrome-extension |
onclick or inline script isn’t working in extension | 因為CSP的關係onclick沒辦法直接在html中新增進去,但是你可以直接用JS新增onclick的動作進去 | google-chrome-extension |
Adding JavaScript type hints for VSCode/Monaco Intellisence | /** @type {WebGLRenderingContext} */ | js |
HTML dataset - how to put object? data-x={} | 利用 JSON.parse(myString) | js |
Why is 4 not an instance of Number? | 要注意 instanceof Number 會得到false | js |
Return positions of a regex match() in Javascript? | [...str.matchAll(regexp)].forEach(match=>{}) | js |
what is the key code for shift+tab? | e.shiftKey && e.key === 'Tab' | js |
Scroll to bottom of div? | objDiv.scrollTop = objDiv.scrollHeight | js |
How to execute somethnig finally in Javascript swich-case statement? | | js |
Format JavaScript date as yyyy-mm-dd | | js |
querySelectorAll with multiple conditions | 找p或者span的節點: document.querySelector("p, span") 優先找前面的(p) | js |
Changing image size in Markdown |  | markdown |
indexOf method in an object array? | 如果您的array的元素是一個object,當您想要indexOf這個object,那麼必須取得當初餵進去的那個object。不能隨意在new一個出來,即便new出來的資料結構和數值相同,也是不行 | js |
Execute Script of Chrome extension only once | | google-chrome-extension |
Change text from “Submit” on input tag | <input type="submit" value="..."> type等於submit的時候會自動用瀏覽器選擇的locale來放文字,如果不想要這樣,可以給定value來指定為某文字 | js |
Failed to execute ‘createObjectURL’ on ‘URL’: | 使用 video.srcObject = mediaStream 不要用 video.src = URL.createObjectURL(mediaStream) 這種做法會被逐漸淘汰! | js |
Why is the ‘ended’ event not firing for this MediaStreamTrack? | | google-chrome-extension |
How to listen for “Stop sharing” click in Chrome DesktopCapture API | stream.oninactive = () => {} or stream.getVideoTracks()[0].onended = () => {} | js |
ffmpeg -i input.webm -c copy output.mp4 | ffmpeg -i input.webm -c copy output.mp4 | ffmpeg |
Is it possible to use the MediaRecorder API with html5 video? | | js |
how to use ffmpeg to merge WebM audio (Opus) and MP4 video (H.264) into one MP4 file | 如果沒有音頻要重新編碼要補上-c:a aac 完整範例 ffmpeg -i result.webm -c copy -c:a aac output.mp4 | ffmpeg |
How to do something before on submit? | 在submit的時候回傳false可以取消submit的動作 form.onsubmit = e => {return false } | js |
How to escape HTML | 轉譯,使其成為安全的字串,例如如果您的title為…如果置換到innerHTML會得到一個按鈕,所以需要把特殊的符號轉譯。 轉譯的方法: new Option(str).innerHTML | js |
Chrome Extensions creating a .html page accessible by clicking browser action. | chrome.tabs.create({ url: chrome.runtime.getURL("index.html") | google-chrome-extension |
Include another HTML file in a HTML file | | js |
How to get the value from the GET parameters? | new URL(document.URL).searchParams.get("para") | js |
What’s the difference between HTML ‘hidden’ and ‘aria-hidden’ attributes? | hidden只是看不到而已,但不代表他對殘障者有效。aria-hidden會整個都有效 | |
Get the current URL with JavaScript? | window.location.host ● window.location.host ● window.location.pathnam | js |
Redirecting to a relative URL in JavaScript | window.location.href = '../'; //one level up , window.location.href = '/path'; //relative to domain | js |
Internationalization of HTML pages for my Google Chrome Extension | | google-chrome-extension |
Get File Name and Parent Folder of URL | myPath.split('/').slice(-2).join('/') | js |
How to dynamically change a web page’s title? | document.title = "This is the new page title." | js |
How do I convert a video to GIF using ffmpeg, with reasonable quality? | ffmpeg -ss 30 -t 3 -i input.mp4 -vf "fps=10,scale=320👎flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif ffmpeg -i input.mp4 -vf "fps=10,scale=320👎flags=lanczos" -c:v pam -f image2pipe - convert -delay 10 - -loop 0 -layers optimize output.gif | ffmpeg |
Font-awesome, input type ‘submit’ | 把<input type="submit"> 改成使用<button type="submit"><i class="fa far-... fa-2x"> button-name </i> 即可 | js |
drag drop files into standard html file input | | js |
How can I serialize an input File object to JSON? | | js |
How to import a JSON file in ECMAScript 6? | | js |
How to load data from a CSV file in D3 v5 | d3至從v5以後d3.csv回傳的是一個promise | d3.js |
Parse Uploaded CSV file using D3.js | | d3.js |
How to change the style of the title attribute inside an anchor tag? | | js |
How to generate thumbnail images of HTML pages | | js |
How to use Google Chrome Thumbnails preview service? | | google-chrome-extension |
How to add image to canvas | ctx.drawImage(new Image, 0, 0) | js |
How to crop canvas.toDataURL | | js |
Using HTML5/Canvas/JavaScript to take in-browser screenshots | | js |
Ways to see a list of all the tabs open in Chrome? | | google-chrome-extension |
Displaying a custom animation at the click location on Windows 10 in response to an event | | ahk |
Cutting the videos based on start and end time using ffmpeg | ffmpeg -i input.mp4 -ss 01:19:27 -to 02:18:51 -c:v copy -c:a copy output.mp4 | ffmpeg |
Add audio to video using FFmpeg | | ffmpeg |
Python convert mp3 to wav with Pydub | subprocess.call(['ffmpeg', '-i', '/input/file.mp3','/output/file.wav']) | ffmpeg, python |
Chrome Extension Message passing: response not sent | | google-chrome-extension |
“Cannot read property of undefined” when using chrome.tabs or other chrome API in content script | | google-chrome-extension |
What does “http:///”, “https:///” and “<all_urls>” mean in the context of Chrome extension’s permissions | “<all_urls>” : matches any URL that starts with a permitted scheme (http:, https:, file:, ftp:, or chrome-extension | google-chrome-extension |
How do I find out if connectNative failed or succeeded | | google-chrome-extension |
How can I read from standard input in the console? | | go |
How to print struct variables in console? | fmt.Printf("%#v ", myStruct) 輸出json格式 +v 會省略掉" 可能更不好閱讀 | go |
Ways to see a list of all the tabs open in Chrome? | Ctrl+Shift+A | superuser, chrome |
Start an external application from a Google Chrome Extension? | Native messaging host | google-chrome-extension, chrome |
What does the w flag mean when passed in via the ldflags option to the go command? | -s disable symbol table -w disable DWARF generation | go |
robocopy transfer file and not folder | robocopy c:\source_folder d:\dist_folder transfer_this.txt | robocopy, bat |
Replace parent element with its contents | h2.replaceWith(h2.firstChild) h2.replaceWith(...h2.childNodes) | js |
How do I get all h1,h2,h3 etc elements in javascript? | document.querySelectorAll("h1, h2, h3, h4, h5, h6") | js |
Is there a JavaScript solution to generating a “table of contents” for a page? | | js,toc |
Can I use a SVG toolbar icon? | No (2009年發問到現在仍然沒有解決) | google-chrome-extension |
Method to convert HTML5 canvas to SVG? | | js |
Checking if browser is in fullscreen | 這可以判斷是否視窗還可以再放大(不是指全螢幕模式) if (!window.screenTop && !window.screenY) {alert('Browser is in fullscreen')} , 如果您再找全螢幕可以參考Fullscreen_API | js |
SVG Favicon Not Working | favicon也可以用svg來代替 <link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml"> | html |
How to view file diff in git before commit | | git |
Where can I find the source code of gitk? | | gitk |
RGB to hex and hex to RGB | parseInt("ff", 16) => 255 (0x1000000 + rgb) | js |
How do I check that a number is float or integer? | Number.isInteger(12.0) true | js |
Convert character to ASCII code in JavaScript | "ABC".charCodeAt(0) // returns 65 String.fromCharCode(65,66,67); // returns 'ABC' | js |
How can I test if a letter in a string is uppercase or lowercase using JavaScript? | | js |
How to get selected word when double-click on div, p, span? | window.getSelection().toString() | js |
Get current clipboard content? | const text = await navigator.clipboard.readText() | js |
Move mouse pointer in JavaScript | document.querySelector('button').focus() | js |
How to JsDoc a “mixed” type? | Any型別: @param {*} 可選項@param {?string} 表示此變數為可選項 | js |
Why is document.execCommand(“paste”) not working in Google Chrome? | document.execCommand("paste") copy和cut都有支持,paste只有ie有支持 | js |
JavaScript get clipboard data on paste event (Cross browser) | window.document.execCommand('insertText', false, "my copy data") | js |
JavaScript: filter() for Objects | Object.keys(obj).filter().reduce() | js |
How to add stroke/outline to transparent PNG image in JavaScript canvas | ★使用js進行contour檢測 | js |
Display image through html image element object | document.createRange().createContextualFragment(img.outerHTML) | js |
highlight all text in textarea | elem.focus() elem.select() | js |
How to exit from setInterval | const interval = setInterval(() => {clearInterval(interval);}, 1000) | js |
Can Read-Only Properties be Implemented in Pure JavaScript? | Object.defineProperty(obj, prop, descriptor) | js |
How to combine WebM and Opus to generate MP4? | -c:v libx264 | ffmpeg |
Transposing a 2D-array in JavaScript | [matrix[i][j], matrix[j][i]] = [matrix[j][i], matrix[i][j]]; | js |
Display JSON data on a page as a expandable/collapsible list | | js |
How can I check if an object is an array? | Object.prototype.toString.call(someVar) === '[object Array]') | js |
How to use endsWith with multiple values? | x instanceof Array or x instanceof Object ["Object", "Array"].some(type=>Object.prototype.toString.call(value).endsWith(type + "]")) | js |
Display JSON data on a page as a expandable/collapsible list | | js,json |
Can I use ES6’s arrow function syntax with generators? (arrow notation) | 生成函數 function* | ECMA, js |
How to create an array containing 1…N | 嘗試著用generator求解吧! | js |
How do I make JavaScript Object using a variable String to define the class name? | const MyClass = eval("MyClassName") | js |
Check if variable holds File or Blob | myFile instanceof File myBlob instanceof Blob | js |
Where can I find a pre-populated json file for testing? | http://mysafeinfo.com/api/data?list=englishmonarchs&format=json | json |
Add text before or after an HTML element | insertAdjacentHTML divElem.insertAdjacentHTML("afterbegin", " ") or divElem.insertAdjacentText("afterbegin", " ") | js |
Call a function after leaving input field | addEventListener("blur", ()=>{}) 可以用來確定是否離開了input視窗 | js |
How do you clear the focus in javascript? | myElem.blur() | js |
contenteditable change events | | js |
How could I pass a dynamic set of arguments to Go’s command exec.Command? | command-line-flags | go |
Is it possible to search for a particular filename on GitHub? | 使用快捷鍵T之後再打上您的檔案 | github, searc |
JS how to cache a variable | window.localStorage window.sessionStorage | js, cache |
What is “export default” in JavaScript? | 簡單來說export default 可以讓你直接import名稱就開始用了,不需要大括號括起來 | js |
Difference between DOMContentLoaded and load events | DOMContentLoaded 不需要等待所有資源都加載完成 | js |
Limit how many times an event listener can trigger every second | | js |
how to use scrollspy without using bootstrap | | js |
Get the size of the screen, current web page and browser window | window.innerWidth | js |
How to fade in a HTML5 dialog? | -webkit-animation @keyframes | js, animation, css |
SVG stroke-width not working | stroke="black" stroke-width="10" 必須要先設定stroke,則stroke-width才會有作用 | svg |
Show file in Windows Explorer using Go? | | go |
How to ask for administer privileges on Windows with Go | | go, admin, UAC |
What does %~d0 mean in a Windows batch file? | | bat |
Something like a function/method in batch files? | | bat |
How to check if value is in range of cells? | =COUNTIF(A1:B7,"d") d是否有在A1~B7之間 | google-spreadsheet |
How to clear history of text input | <form autocomplete="off"> 可以關閉紀錄的功能,但如果您只想要刪除某幾筆被記錄的資料,可以使用 delete或者試試shift+delete,即可刪除 | html |
Javascript to convert Markdown/Textile to HTML (and, ideally, back to Markdown/Textile) | 推薦用mmd | js,markdown |
Get the value of checked checkbox? | document.querySelector("#isDebugMode").checked , document.querySelector("#size:checked")?.value ?? defaultSize | js |
html input field using regex to get rid of invalid characters for filename | input使用pattern來控制輸入項符合檔名的規則 pattern="[^\\/:\x22*?<>]+" | html |
Searching validityState for values | input.validity.{valueMissing, typeMismatch, patternMismatch,...} | js |
HTML5 form required attribute. Set custom validation message? | oninvalid="this.setCustomValidity('Enter User Name Here')" oninput="this.setCustomValidity('')" | html |
[Delay HTML5 :invalid pseudo-class until the first event 在表單有invalid的css屬性時,不要在使用者都還沒有輸入的時候就顯示驗證錯誤] | input:not(:placeholder-shown) | html |
How to have multiple colors in a Windows batch file? | | bat |
Batch syntax highlighting | lang-sh | bat |
Real mouse position in canvas | | canvas |
.attr vs .classed in D3.js | 第二個參數 true:表示增加該屬性, false為移除該屬性 .classed("my-selector", true) | j3.js |
how to draw svg polygon on the points of mouse click position | | svg |
SVG fill color transparency / alpha? | 使用style style="fill:rgba(255, 0, 0, .5) 或者 <circle fill="#044B94" fill-opacity="0.4"> 注意fill直接放rgba是沒有用的,這種只能用style上才有作用 | svg |
Array.from vs Array.prototype.map | | js |
Javascript library d3 call function | | d3.js |
SVG: text inside rect | | svg |
remove last characters string batch | 移除最後一個字符: %myString:~0,-1% | bat |
Get protocol, domain, and port from URL | const full = location.protocol + '//' + location.host; ${location.protocol}//${location.host} | js |
How to display images inline | display: inline-block 可以讓此元素不被換行,也就是可以和前一個元素黏在一列 <img src="favicon.svg" width="55" height="55"><h1 style="display: inline-block">...</h1> | css |
How do I get glyph outlines of a letter as bézier paths using JavaScript? | opentype.js | opentype.js |
SVG icon in PWA manifest.json - how to set it for all sizes? | | pwa |
apple touch icon svg support | | svg, apple-touch-icon |
Whether all icon sizes can be used when using SVG in PWA manifest | | svg, pwa |
Get the last item in an array | 使用at方法 array.at(-1) 但目前safari沒有支持,查看 | js |
DOMException on calling navigator.clipboard.readText() | 執行navigator.clipboard.writeText 得到Document is not focused.的錯誤,原因可能是因為你在devTool下中斷點的關係,導致focus沒有正常運行,不建議在此語句上下中斷點,確定一下文本沒有問題即可讓他自動執行 | clipboard, js |
How can I export GitHub issues to Excel? | curl -i https://api.github.com/repos/<repo-owner>/<repo-name>/issues --header "Authorization: token <token>" | github.issue |
How to set “aggregate column a” with setOptions | .setOption('applyAggregateData', true) | google.sheets |
How do I zip two arrays in JavaScript? | const zip = (a, b) => a.map((k, i) => [k, b[i]]); 另一個版本 解決更複雜的情況 | js |
How to solve TypeError: d3.time is undefined? | 把d3.time.format 改成d3.timeFormat , d3.time.days 改成d3.timeDay | d3 |
How to access new ‘in-cell-image’ from google apps script? | | gas |
D3.js: Trying to build flat calendar | | d3.js |
vertical text in d3 (not rotated) | 使用rotate(-90) + | d3.js |
Custom Google Spreadsheet/Sheets toolbar | | gas |
How to set Hours,minutes,seconds to Date which is in GMT | date.setHours(0, 0, 0); // Set hours, minutes and seconds | js |
Find the element before and after a specific element with pure javascript | 要用elem.nextElementSibling 不要用elem.nextSibling | js |
Is it possible to alter a CSS stylesheet using JavaScript? (NOT the style of an object, but the stylesheet itself) | document.styleSheets[0].cssRules | js |
How can I choose a legible color to draw text on a bar in a d3js chart? | 這種算法簡單但是不完美,最好用流明來決定顏色const foreColor = d3.hsl(d3.color("steelblue")).l > 0.5 ? "#000" : "#fff" | d3.js |
Calculating contrasting colours in javascript | | js |
Regular expression for floating point numbers | [+-]?([0-9]*[.])?[0-9]+ | js |
How to center a checkbox in a table cell? | 改善checkbox在偏上的問題 vertical-align: middle; | css |
Placing border inside of div and not on its edge | 一般的border border: 2px solid red 會佔空間,導致自動換行產生,這時候可以使用outline: 2px solid red 搭配 outline-offset: -2px; 來幫忙 | css |
create fonts subset using opentype.js getting “OTS parsing error: cmap: Failed to parse table” error | | opentype.js |
SVG - click is not a function | mySVGElem.dispatchEvent(new Event('click')) | svg |
HTML5 input type range show range value | <input type="range" value="24" min="1" max="100" oninput="this.nextElementSibling.value = this.value"><output>24</output> | html |
How to get client’s IP address using JavaScript? | fetch('https://ipinfo.io/json') | js,ip |
Mongodb-go-driver interface conversion: interface {} is primitive.ObjectID, not primitive.ObjectID (types from different packages) | 這是由斷言所觸發的錯誤,表示該型別為primitive.ObjectID 這個的原型是一個array[12]byte | mongodb |
golang: return a pointer or pass a reference | | golang |
In mongodb-go-driver, how to marshal/unmarshal BSON in to a struct | | |
How to extract the hostname portion of a URL in JavaScript | 利用new URL("...") 在使用URL的方法去獲得相關的網址 | |
Calculate a percent with SCSS/SASS | $my_width: 4/12*1%; | sass |
SVG path to create triangle with rounded corners | 補上stroke-linejoin:round 以及stroke 即可讓三角形的稜角比較圓滑,範例:<polygon style="stroke-linejoin:round" stroke="#f7c9c7" fill="#f7c9c7" points="80,50 30,25 30,75" /> | svg |
HTML5 Audio stop function | audio.pause(); audio.currentTime = 0; | js |
Html 5 audio tag custom controls? | video::-webkit-media-controls-panel | html |
javascript slowly decrease volume of audio element | setInterval() | js |
javascript -Dynamic pagination pure Js | | js |
Convert a 1D array to 2D array | while(arr.length) newArr.push(arr.splice(0,3)) | js |
How to handle “Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first.” on Desktop with Chrome 66? | 因為網頁policy的關係,不允許影片自動撥放,所以解決方式先用靜音,在撥放影片(只能是靜音) | js |
Can a Windows batch file determine its own file name? | | bat |
Can we use google analytics for Internal website? | | google analytics |
Batch File; List files in directory, only filenames? | for /f tokens^=* %%i in ('where /r .\src\app\urls\static\js *.min.js') do echo %%i | bat |
Golang https certificate error: remote error: tls: unknown certificate authority | | tls, ssl |
what’s the proper file extension or abbr. for golang’s text/template? | .gohtml | go |
ffmpeg - replace audio in video | ffmpeg -i v.mp4 -i a.wav -c:v copy -map 0✌️0 -map 1🅰️0 new.mp4 | ffmpeg |
Extracting substrings in Go | myString[len(myString)-2:] | go |
Showing custom 404 error page with standard http package | 新增其他的handler,執行該handler即可 | go |
Set content of iframe | document.querySelector("iframe").src = "data:text/html;charset=utf-8," + escape(htmlString) | iframe |
iframe background image | <iframe class="bg-repeat-cover bg-bermuda-circle-orange"></iframe> | iframe |
Run both HTTP and HTTPS in same program | | go, tls, https |
Using named matches from Go regex | | go, regex |
Convert string to integer type in Go? | | go |
Defining Independent FlagSets in GoLang | | go, flag |
Generating the SHA hash of a string using golang | | go, sha |
Golang flag: Ignore missing flag and parse multiple duplicate flags | | go, flag |
How to run a makefile in Windows? | choco install make | makefile |
Command line to remove an environment variable from the OS level configuration | REG delete HKCU\Environment /F /V MyVar | batch |
How to write loop in a Makefile? | | makefile |
Docker cannot start on Windows | | docker |
How do I uninstall a Chocolatey package and all its dependencies? | | choco |
How can I clear the terminal screen in Go? | | go |
How to delete border spacing in table | table { border-collapse: collapse; } | css |
Why is contenteditable not a style? | read-write-plaintext-only | css |
Get the ID of an element where the class contains a given string | 使用[attr~=value] 就能代表屬性中有此值就能套用 MDN參考 | css |
colspan not working | td.colSpan 是大寫 | js |
Get protocol, domain, and port from URL | new URL().{hostname, port, search, pathname, protocol} | js |
Adding options to select with javascript | selectElement.add(new Option(text, value, defaultSelected, selected)) | js |
fade in and out on simple css tooltip | | css |
CSS Variables and String concatenation | 很遺憾這樣用還是不行 .myCls:after {--title: attr(title); content: "🔔" + var(--title)} | css |
Can I use HTML tags in the options for select elements? | 目前不行,要自己用div搭配js來做。 | html |
http://timestamp.verisign.com/scripts/timstamp.dll not available | http://timestamp.digicert.com | signtool |
How can I set the default value for an HTML element? | <option value="" selected disabled hidden> disabled不能再選,hidden看不到 | html |
Can I use a :before or :after pseudo-element on an input field? | input沒辦法加上before或者after | html |
How can I see the size of a GitHub repository before cloning it? | https://github.com/settings/repositories | github |