hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035},{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064}]}'
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
| [user] | |
| name = John Doe | |
| email = johndoe@gmail.com |
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
| import { useRef } from 'react'; | |
| let uniqueId = 0; | |
| const getUniqueId = () => uniqueId++; | |
| export function useComponentId() { | |
| const idRef = useRef(getUniqueId()); | |
| return idRef.current; | |
| } |
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
| copy( | |
| encodeURIComponent(`(function() { | |
| function readLocalFile(e) { | |
| const file = e.target.files[0]; | |
| if (!file) { | |
| alert('No file selected!') | |
| } | |
| const reader = new FileReader(); | |
| reader.onload = function(e) { | |
| const contents = e.target.result; |
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
| /* | |
| The number of changed files (additions/deletions) includes all files. | |
| I wanted to see how many files I had changed, excluding tests and test snapshots. | |
| This filter will help you do that. | |
| To use it, go to the PR, navigate to "Files" and invoke the following | |
| */ | |
| (function() { | |
| const excludeWords = ['test', 'mock-responses', 'typings']; |
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 hypercore = require('hypercore'); | |
| const discovery = require('discovery-swarm'); | |
| const multifeed = require('multifeed'); | |
| const pump = require('pump'); | |
| const suffix = process.argv[2]; | |
| const db = `./multichat-${suffix}`; | |
| console.log(`Using db: ${db}`); | |
| const multi = multifeed(hypercore, db, { valueEncoding: 'json' }); |
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
| # yarn add puppeteer | |
| # node ./puppeteer-random-page.js | |
| const puppeteer = require('puppeteer'); | |
| const initialUrl = process.env.url || 'http://localhost:8080'; | |
| async function init() { | |
| const browser = await puppeteer.launch({ headless: true }); | |
| return browser.newPage(); | |
| } |
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
| { | |
| "scripts": { | |
| "browserify": "browserify --standalone myModuleName ./src/index.js | uglifyjs --compress --source-map --output dist/index.min.js" | |
| }, | |
| "browserify": { | |
| "transform": [ | |
| [ | |
| "babelify", | |
| { | |
| "presets": [ |
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
| // Usage: jscodeshift -t replace-webpack-alias-with-relative-path.js ./kibana/x-pack/plugins ./kibana/src | |
| const path = require('path'); | |
| const URI = require('urijs'); | |
| function getRelativePath(currentFilePath, dependencyPath) { | |
| return URI(dependencyPath) | |
| .relativeTo(currentFilePath) | |
| .toString(); | |
| } |
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 input = { | |
| email: { | |
| subject: 'Happy birthday {{name}} 🎂', | |
| body: 'Hi {{name}}, you are turning {{age}} today!' | |
| } | |
| }; | |
| const ctx = { name: 'Søren', age: 30 }; | |
| const tmpl = renderMustache(input, ctx); | |
| // tmpl: {"email": {"subject": "Happy birthday Søren 🎂", "body": "Hi Søren, you are turning 30 today!"}} |