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
const S = [1, 2, 3]; | |
const n = 4; | |
const f = (S, n) => { | |
const stack = S.map((coin) => [coin]); | |
const permuts = new Set(); | |
while (stack.length) { | |
const current = stack.shift(); | |
const sum = current.reduce((s, c) => s + c); |
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
const S = [1, 2, 3]; | |
const n = 4; | |
const f = (S, n) => { | |
const stack = S.map((coin) => [coin]); | |
const permuts = new Set(); | |
while (stack.length) { | |
const current = stack.shift(); | |
const sum = current.reduce((s, c) => s + c); |
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
// https://leetcode.com/submissions/detail/508355858/ | |
/** | |
* Definition for singly-linked list. | |
* function ListNode(val, next) { | |
* this.val = (val===undefined ? 0 : val) | |
* this.next = (next===undefined ? null : next) | |
* } | |
*/ | |
/** | |
* @param {ListNode} l1 |
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
const degrees = 180 / Math.PI; | |
function radian2degrees (rad: number): number { | |
return rad * degrees; | |
} | |
function degrees2radian (deg: number): number { | |
return deg / degrees; | |
} |
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
" Inspired by @ Christian Brabandt on this question https://vi.stackexchange.com/q/20066/1841 | |
function! SetVisualBlock(start, end) | |
" Trigger visual block mode | |
execute "norm! \<C-v>\<Esc>" | |
" Set the marks | |
call setpos("'<", [ 0, a:start[0], a:start[1] ]) | |
call setpos("'>", [ 0, a:end[0], a:end[1] ]) |
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
--- Actions --- | |
$Copy <M-C> | |
$Cut <M-X> <S-Del> | |
$Delete <Del> <BS> <M-BS> | |
$LRU | |
$Paste <M-V> | |
$Redo <M-S-Z> <A-S-BS> | |
$SearchWeb <A-S-G> | |
$SelectAll <M-A> | |
$Undo <M-Z> |
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 is a test answer for https://vi.stackexchange.com/q/17423/1841 | |
" <C-a> | |
nnoremap <Leader>a :call CoherentIncrement(1)<CR> | |
" <C-x> | |
nnoremap <Leader>b :call CoherentIncrement(0)<CR> | |
function! CoherentIncrement(inc) | |
let save_cursor = getcurpos() |
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! MakeNewLine() | |
if getline(line('.')) =~# "^\s*>.*$" | |
normal! o> | |
else | |
normal! o | |
endif | |
endfunction | |
inoremap <cr> <C-o>:call MakeNewLine()<cr> |
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
## Install seedbox system for several users with | |
## Transmission | |
## Sonarr | |
## Headphones | |
## | |
## Debian 8 | |
# References: | |
# DOCKER INSTALL - https://docs.docker.com/engine/installation/linux/debian/ | |
# SHIPYARD (docker management) - https://github.com/shipyard/shipyard |
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
augroup pythonFold | |
autocmd BufReadPre *.py setlocal foldmethod=indent | |
autocmd CursorMovedI *.py call PinFold() | |
autocmd CursorMoved *.py call PinFold() | |
augroup END | |
function! PinFold() | |
" save current position | |
let saveCursor = getcurpos() | |
NewerOlder