Skip to content

Instantly share code, notes, and snippets.

View veirus's full-sized avatar

Alex veirus

View GitHub Profile
@huytd
huytd / todo.vim
Created June 14, 2020 07:34
A Todo list syntax in Vim, with an actual checkbox
" Vim syntax file
" Language: Todo
" Maintainer: Huy Tran
" Latest Revision: 14 June 2020
if exists("b:current_syntax")
finish
endif
" Custom conceal
@flatlinebb
flatlinebb / mpv keyboard shortcuts
Last active January 6, 2024 09:38
mpv keyboard shortcuts
Keyboard Control
LEFT and RIGHT
Seek backward/forward 5 seconds. Shift+arrow does a 1 second exact seek (see --hr-seek).
UP and DOWN
Seek forward/backward 1 minute. Shift+arrow does a 5 second exact seek (see --hr-seek).
Ctrl+LEFT and Ctrl+RIGHT
Seek to the previous/next subtitle. Subject to some restrictions and might not always work; see sub-seek command.
Ctrl+Shift+Left and Ctrl+Shift+Right
Adjust subtitle delay so that the next or previous subtitle is displayed now. This is especially useful to sync subtitles to audio.
[ and ]
@ramil-k
ramil-k / i.js
Created June 22, 2018 18:44
iterators to generators
const movies = {
action: ['dark', 'aveng'],
comedy: ['life', 'lights'],
[Symbol.iterator]*() {
for (let movies of Object.values(this)) {
// option 1:
for (let movie of movies) {
yield movie;
}
// option 2 (see https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Statements/function* for details):
@jeremiegirault
jeremiegirault / README.md
Last active December 9, 2022 02:10
Use inline SVG in vue.js

Install svg-inline-loader for webpack :

npm install svg-inline-loader --save-dev

Add it to your loaders in module.loaders section of webpack.config.js:

{
  test: /\.svg$/,
 loader: 'svg-inline-loader'
@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@lleaff
lleaff / Discord_-_Open_chat_in_popup.user.js
Last active September 9, 2021 22:08
Adds a "open in popup" button to channels
// ==UserScript==
// @name Discord - Open chat in popup
// @namespace lleaff
// @updateURL https://gist.github.com/lleaff/8514033dc8e54ce02d6adf3c2e46d8ff/raw/Discord_-_Open_chat_in_popup.user.js
// @supportURL https://gist.github.com/lleaff/8514033dc8e54ce02d6adf3c2e46d8ff#comments
// @match https://discordapp.com/channels/*
// @version 1
// @run-at document-end
// @grant none
// @noframes
@UrsaDK
UrsaDK / Strip trailing space in Vim.md
Last active April 5, 2023 17:11
A function to remove trailing spaces from Vim buffers

I've been maintaining my own version of Strip Trailing Spaces function (attached at the bottom of this post) since I first started using vim. It grew out of a simple :%s/\s*$// and now includes a number of features:

  • it preserves search history and the last search string
  • it doesn't change editor's '', '. and '^ marks
  • it doesn't add a new jumplist and changelist record
  • it preserves editor's view and cursor position

However, over the years I've noticed that I never needed to undo the results of stripping trailing spaces from a file. In fact, I would go as far as to say that when undoing changes in a file, the function produces an understandable but somewhat undesirable cursor jump (to the top-most trailing space it strippes) which disrupts my work flow. So, I set about to exclude the results of this function from the undo history all together.

After reading [Restore the cursor position after undoing text change made by a script](http://vim.wikia.com/wiki/Restore_the_cursor_position_aft

@nkbt
nkbt / .eslintrc.js
Last active April 3, 2024 13:16
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@praveenvijayan
praveenvijayan / Copy text directly from Photoshop text layer.
Last active December 19, 2019 05:23
Copy text directly from text layer. Works above photoshop cs6. Copy following script file into /Applications/Adobe Photoshop CC 2014/Presets/Scripts (MAC) or C:\Program Files\Adobe\Adobe Photoshop CC 2014\Presets\Scripts (WIN). Assign shortcut for easy access (cmd+option+c / ctrl+alt+c)
/*****************************************************************
*
* Copy Layer text 1.0 - by Praveen Vijayan! - http://www.decodize.com/
*
* Compatibility above Photoshop CS6
*
* Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
*
*****************************************************************/