Skip to content

Instantly share code, notes, and snippets.

@LearnWebCode
LearnWebCode / keybindings.json
Last active April 6, 2023 19:57
In VS Code on Mac; change from control + number to cmd + number to jump between open editors.
// Place your key bindings in this file to override the defaults
[
{ "key": "cmd+1", "command": "workbench.action.openEditorAtIndex1" },
{ "key": "cmd+2", "command": "workbench.action.openEditorAtIndex2" },
{ "key": "cmd+3", "command": "workbench.action.openEditorAtIndex3" },
{ "key": "cmd+4", "command": "workbench.action.openEditorAtIndex4" },
{ "key": "cmd+5", "command": "workbench.action.openEditorAtIndex5" },
{ "key": "cmd+6", "command": "workbench.action.openEditorAtIndex6" },
{ "key": "cmd+7", "command": "workbench.action.openEditorAtIndex7" },
{ "key": "cmd+8", "command": "workbench.action.openEditorAtIndex8" },
@LearnWebCode
LearnWebCode / chrome.scpt
Last active September 23, 2022 21:01
macOS Tell Chrome & Safari to Be Certain Size in Certain Screen Position
tell application "Google Chrome" to activate
tell application "System Events"
tell process "Google Chrome"
click menu item "New Incognito Window" of menu "File" of menu bar 1
end tell
end tell
tell first window of application "Google Chrome" to set bounds to {0, 109, 967, 658}
@LearnWebCode
LearnWebCode / settings.json
Last active September 8, 2022 02:06
My personal Visual Studio Code settings
{
"php.validate.executablePath": "/usr/local/bin/php",
"editor.minimap.enabled": false,
"editor.fontSize": 16,
"editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",
"terminal.integrated.fontSize": 16,
"workbench.editor.showTabs": true,
"editor.hover.enabled": false,
"editor.tabSize": 2,
"telemetry.telemetryLevel": "off",
@LearnWebCode
LearnWebCode / javascriptreact.json
Created March 11, 2021 22:59
React Visual Studio Code Snippets for component, useEffect, useState, and useImmerReducer
{
"React Component": {
"prefix": "rc",
"body": ["import React, { useEffect } from \"react\"", "", "function ${1:ComponentName}() {", " return (", " <>", " $2", " </>", " )", "}", "", "export default ${1:ComponentName}"],
"description": "React Component"
},
"useEffect": {
"prefix": "ue",
"body": ["useEffect(() => {", " $2", "}, [$1])"],
"description": "useEffect"
@LearnWebCode
LearnWebCode / yourFunction.js
Created November 13, 2020 22:19
Connect to MongoDB / Atlas within Netlify / AWS Lambda Serverless Function File
const mongodb = require("mongodb")
exports.handler = async function (event, context) {
const client = await mongodb.connect(process.env.CONNECTIONSTRING, { useUnifiedTopology: true })
const db = client.db()
try {
const dogs = await db.collection("pets").find({ species: "dog" }).toArray()
client.close()
return {