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.exports = { | |
presets: [ | |
['@babel/preset-env', { | |
useBuiltIns: 'usage', | |
debug: false, | |
loose: true, | |
corejs: { | |
version: 3, | |
proposals: true, | |
}, |
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
[ | |
// 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", |
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 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 }, |
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.exports = { | |
root: true, | |
overrides: [ | |
{ | |
files: ['*.graphql'], | |
plugins: ['@graphql-eslint'], | |
parser: '@graphql-eslint/eslint-plugin', | |
parserOptions: { | |
operations: './query.graphql', | |
}, |
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 weightedChoice(weights) { | |
const weightSum = weights.reduce((sum, w) => sum + w) | |
let choice = Math.floor(Math.random() * weightSum) + 1 | |
let idx = weights.length - 1 | |
while ((choice -= weights[idx]) > 0) { | |
idx -= 1 | |
} | |
return idx | |
} |
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
$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); |
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
{ | |
"modules": true, | |
"plugins": { | |
"autoprefixer": {} | |
} | |
} |
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
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 |
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
/** | |
* Applies a Caesar shift to all alphabetical characters in a string. | |
* Characters are converted to uppercase in the returned string. | |
* @param {int} key - Positions to shift (0-25). | |
* @param {string} str - The string to shift. | |
* @return {string} The shifted string. | |
*/ | |
function caesarShift(str, key) { | |
return str.toUpperCase().replace(/[A-Z]/g, c => String.fromCharCode((c.charCodeAt(0)-65+key)%26+65)) | |
} |
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
// Put cursor v there and wait until YCM+tsserver has initialized | |
const x = []. |
NewerOlder