Skip to content

Instantly share code, notes, and snippets.

@mikowl
mikowl / oneliners.js
Last active March 28, 2024 20:52
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@jackiewu
jackiewu / translate.js
Last active August 24, 2022 09:29
網頁翻譯: 簡體中文 <-> 繁體中文
// 在瀏覽器網址列輸入以下程式碼,或者是新增一個我的最愛項目,把網址的內容改為以下即可。
// 搜尋currentEncoding=2,targetEncoding=1 (簡轉繁)反之(繁轉簡)請自行修改
javascript:"use strict";var ts=document.createElement("script");ts.setAttribute("src","https://52.197.103.234/chinese_convert.js");var _document$getElements=document.getElementsByTagName("head"),head=_document$getElements[0];head.appendChild(ts),ts.onload=function(){currentEncoding=2,targetEncoding=1,translateBody()};
// Example "姓名" (&#22995;&#21517;)
// it can be used for placehoder of input
"姓名".charCodeAt(0)
> 22995
"姓名".charCodeAt(1)
> 21517
"姓名".charCodeAt(0).toString(16)
> "59d3"
@jackiewu
jackiewu / No JS: Tabs that scale down to menu.markdown
Created June 2, 2016 02:25
No JS: Tabs that scale down to menu

No JS: Tabs that scale down to menu

A tab-to-menu layout that doesn't use javascript. Modern browser compatible.

A Pen by Jake Albaugh on CodePen.

License.

@jackiewu
jackiewu / Pull Menu - Menu Interaction Concept.markdown
Created June 1, 2016 05:43
Pull Menu - Menu Interaction Concept
@darwin
darwin / gist:d74ddce510f4a0b40b29
Created May 27, 2014 15:56
How to fix TotalFinder / Finder ghost window icons on Desktop (when dragging/tearing Finder's tab off)
osascript -e "tell application \"Finder\" to quit" && defaults write com.apple.finder DisableAllAnimations -bool false && defaults write com.apple.finder AnimateWindowZoom -bool true && defaults write com.apple.finder TotalFinderDontFixInstallerDefaults -bool true
@vertexclique
vertexclique / cracking.md
Last active May 11, 2024 21:17
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@zlalanne
zlalanne / tmux_cygwin.md
Last active February 3, 2023 23:33
tmux on Cygwin

Steps to install tmux in Cygwin

Install required Cygwin packages

  1. run Cygwin setup.exe
  2. install these packages that are not installed by default: automake, gcc, git and pkg-config

Install libevent

  1. browse http://libevent.org
  2. download libevent-2.0.21-stable.tar.gz