alias tnew='tmux new -s' # new a session
alias tls='tmux ls' # list all sessions
alias topen='tmux a -t' # open one of sessions with session number
alias tlast='tmux a' # resume last used session
alias tkill='tmux kill-session -t' # kill one of sessions with session number
alias tkillall='tmux kill-server' # kill all sessions
This file contains 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
arr = [1, 2, 3, 4 , 5] | |
arr[Math.floor(Math.random() * arr.length)] |
This file contains 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
module ImgageValidate | |
module_function | |
def url_exist?(url) | |
uri = URI.parse(url) | |
Net::HTTP.start(uri.host, uri.port) do |http| | |
Net::HTTP.start(uri.host, uri.port) do |http| | |
response = http.head(uri.path) | |
case response | |
when Net::HTTPSuccess, Net::HTTPRedirection |
o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
O.......Recursively open the selected directory..................|NERDTree-O|
This file contains 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
/* | |
This hook allows reading and setting url query params. | |
Usage example: | |
const [query, setQuery] = useQueryParam({ | |
name: 'q', | |
}); | |
*/ | |
import { useState, useEffect, useCallback } from 'react'; | |
import { useHistory, useLocation } from 'react-router-dom'; |
This file contains 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
function debounce(func, delay) { | |
let timerId; | |
return function (...args) { | |
clearTimeout(timerId); | |
timerId = setTimeout(() => { | |
func.apply(this, args); | |
}, delay); | |
}; |
This file contains 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
function throttle(func, delay) { | |
let isThrottled = false; | |
return function (...args) { | |
if (!isThrottled) { | |
func.apply(this, args); | |
isThrottled = true; |