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
| -- put into ~/.hammerspoon | |
| -- map Caps Lock key to Control in macOS settings (Keyboard -> Modifier Keys...) | |
| -- Give all the accessability permissions in Hammerspoon preferences | |
| -- NOTE: Changing "Key repeat rate" and "Delay until repeat" in macOS settings | |
| -- require Hammerspoon restart to pick up those changes. | |
| -- See: https://github.com/Hammerspoon/hammerspoon/issues/3264 | |
| local function pressFn(mods, key) | |
| if key == nil then | |
| key = mods |
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
| export class Maybe<T> { | |
| value: T | null | |
| constructor(value: T | null) { | |
| this.value = value | |
| } | |
| static property<P>(value: P | undefined): Maybe<P> { | |
| if (value === undefined) { | |
| return new Maybe<P>(null) |
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
| function square (x) { | |
| return [x * x, () => console.log(x * x)] | |
| } | |
| function feet (x) { | |
| return [x * 3.28084, () => console.log(x * 3.28084)] | |
| } | |
| function compose (fn1, fn2) { | |
| return (x) => fn2(fn1(x)) |
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 fs = require('fs') | |
| const { PerformanceObserver, performance } = require('perf_hooks'); | |
| const cheerio = require('cheerio') | |
| const { JSDOM } = require("jsdom") | |
| const { tokenize, constructTree } = require('hyntax') | |
| const html = fs.readFileSync('./github.html').toString() | |
| const obs = new PerformanceObserver((items) => { | |
| console.log(items.getEntries()) |
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
| show_exit_code() { | |
| local ex=$? | |
| if [ $ex -ne 0 ] | |
| then | |
| echo -e "\033[0;31m$ex\033[0m" | |
| fi | |
| } | |
| PROMPT_COMMAND="show_exit_code;$PROMPT_COMMAND" |
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
| function clientRender () { | |
| let root = document.body | |
| function createElement (name, attrs, children) { | |
| let element = document.createElement(name) | |
| Object.keys(attrs).forEach((attrName) => { | |
| element.setAttribute(attrName, attrs[attrName]) | |
| }) |
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
| cd $HOME | |
| rm .bash_it 2>/dev/null | |
| rm .bashrc 2>/dev/null | |
| rm .bash_profile 2>/dev/null | |
| rm .vimrc 2>/dev/null | |
| rm .tmux.conf 2>/dev/null | |
| rm .viminfo 2>/dev/null | |
| rm -rf .vim 2>/dev/null | |
| rm -rf .dotfiles 2>/dev/null | |
| rm -rf .tmux 2>/dev/null |
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
| cd $HOME | |
| git clone [email protected]:nik-garmash/.dotfiles.git | |
| cd $HOME/.dotfiles | |
| git submodule init && git submodule update | |
| cd $HOME | |
| if [ -f .bashrc ] | |
| then | |
| mv .bashrc .bashrc.b | |
| fi |
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
| /* | |
| Реализация i-statefull-block | |
| https://github.yandex-team.ru/Metrika/metrika-contrib/tree/master/blocks/common/i-statefull-block | |
| */ | |
| BEM.DOM.decl({block: 'stateful-parent', baseBlock: 'i-statefull-block'}, { | |
| onSetMod: { | |
| js: function () { | |
| this._model = BEM.blocks['m-parent'].create(); | |
| this.setStateModel(this._model); |
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
| reindent region C-M-\ | |
| cut region C-w | |
| copy region M-w | |
| yank C-y | |
| kill window C-x 0 | |
| kill window and buffer C-x 4 0 | |
| goto line M-g | |
| join current line to upper one M-^ | |
| Seach next C-s |