Skip to content

Instantly share code, notes, and snippets.

View mogelbrod's full-sized avatar

Victor Hallberg mogelbrod

View GitHub Profile
@mogelbrod
mogelbrod / keybindings.json
Last active April 13, 2023 11:47
VSCode settings
[
// Focus previous/next split using cmd (mac) or ctrl (others) + left/right
{
"key": "ctrl+left",
"command": "workbench.action.focusPreviousGroup",
"when": "!isMac && editorTextFocus && vim.active && vim.mode != 'Insert'",
},
{
"key": "cmd+left",
"command": "workbench.action.focusPreviousGroup",
@mogelbrod
mogelbrod / .eslintrc.js
Last active November 1, 2021 12:52
[@graphql-eslint] Specifying schema via HTTP + local graphql file
module.exports = {
root: true,
overrides: [
{
files: ['*.graphql'],
plugins: ['@graphql-eslint'],
parser: '@graphql-eslint/eslint-plugin',
parserOptions: {
operations: './query.graphql',
},
@mogelbrod
mogelbrod / input.scss
Created May 24, 2021 16:05
Generated by SassMeister.com.
$breakpoints: 0 400px 600px 720px 1000px 1280px 1600px !default;
$scale-names: c xs s m l xl hd !default;
$predefined-spacing: 2px 4px 8px 12px 16px 32px 48px;
@function breakpoint($input, $subtract: false) {
$value: $input;
@if type-of($value) == string {
$value: index($scale-names, $input);
@mogelbrod
mogelbrod / babel.config.js
Last active December 5, 2023 22:18
Prevent core-js polyfills of APIs that should be supported by IE11 for general use (incomplete list)
module.exports = {
presets: [
['@babel/preset-env', {
useBuiltIns: 'usage',
debug: false,
loose: true,
corejs: {
version: 3,
proposals: true,
},
@mogelbrod
mogelbrod / .postcssrc
Created March 27, 2021 15:53
[Parcel v2 & autoprefixer] reproduction of failing builds
{
"modules": true,
"plugins": {
"autoprefixer": {}
}
}
@mogelbrod
mogelbrod / document-element.js
Last active July 13, 2022 21:43
useVirtualScrollParent() hook using useVirtual() from react-virtual
const html = document.documentElement
const body = document.body
/**
Pseudo HTML element which behaves like a regular element in terms of scrolling.
*/
const documentElement = {
set scrollLeft(x) { html.scrollLeft = x },
get scrollLeft() { return window.scrollX || window.pageXOffset },
set scrollTop(x) { html.scrollTop = x },
@mogelbrod
mogelbrod / index.ts
Created December 30, 2019 11:12
vim/ycm long completion popup squished by long menu
// Put cursor v there and wait until YCM+tsserver has initialized
const x = [].
@mogelbrod
mogelbrod / portal.js
Last active May 22, 2020 10:23
Non-bubbling React Portals
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
function portalContainer() {
return document.getElementById('portal-container')
}
// Taken from https://reactjs.org/docs/events.html
diff --git a/autoload/csscomplete.vim b/autoload/csscomplete.vim
index 162171f..799aead 100644
--- a/autoload/csscomplete.vim
+++ b/autoload/csscomplete.vim
@@ -98,14 +98,10 @@ function! csscomplete#CompleteCSS(findstart, base)
let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
for m in s:values
- let postfix = ''
- if strridx(after, ':') < 0
@mogelbrod
mogelbrod / .zshrc
Created June 11, 2018 09:03
Make Ctrl-] copy current input to system clipboard
# Make Ctrl-] copy current input to system clipboard
pbcopy-whole-line() {
echo -n $BUFFER | pbcopy
}; zle -N pbcopy-whole-line
bindkey '^]' pbcopy-whole-line