- Open Automator
- Create a new document
- Select Quick Action
- Set “Service receives selected” to
files or foldersinany application - Add a
Run Shell Scriptaction- your default shell should already be selected, otherwise use
/bin/zshfor macOS 10.15 (”Catalina”) or later - older versions of macOS use
/bin/bash
- your default shell should already be selected, otherwise use
- if you're using something else, you probably know what to do 😉
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
| function searchBlogByTitle(query: string, itemsPerPage: number, lastEvaluatedKey?: string): Promise<any> { | |
| const FIXED_ID_FOR_SEARCH_GSI = "1233421345223"; | |
| let params: AWS.DynamoDB.DocumentClient.QueryInput = { | |
| TableName: "Blog", | |
| IndexName: "BlogSearch", | |
| KeyConditionExpression: "fixedIdForSearchGSI = :pkv", | |
| FilterExpression: "contains(titleInLowerCase, :titleV)", | |
| ExpressionAttributeValues: { | |
| ":pkv": FIXED_ID_FOR_SEARCH_GSI, | |
| ":titleV": query.toLocaleLowerCase() |
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 React from 'react'; | |
| import Router, { NextRouter } from 'next/router'; | |
| // Save the scroll position for the given url | |
| function saveScrollPosition( | |
| url: string, | |
| element: HTMLElement, | |
| savePosition: (url: string, pos: number) => void | |
| ) { |
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
| // in a new folder be sure to run "npm init -y" and "npm install puppeteer" | |
| const puppeteer = require("puppeteer") | |
| const fs = require("fs/promises") | |
| async function start() { | |
| const browser = await puppeteer.launch() | |
| const page = await browser.newPage() | |
| await page.goto("https://learnwebcode.github.io/practice-requests/") | |
| const names = await page.evaluate(() => { |
This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.
const groupBy = keys => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = keys.map(key => obj[key]).join('-');
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
| # https://stackoverflow.com/questions/6543519/undoing-accidental-git-stash-pop | |
| # https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git | |
| accepted | |
| If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda). | |
| Otherwise, you can find it using this for Linux and Unix: | |
| git fsck --no-reflog | awk '/dangling commit/ {print $3}' | |
| and for Windows: |
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
| // Issue: `react-select` `onChange` method doesn't return a proper event | |
| // | |
| // Solution used: | |
| // | |
| // The main idea is to have an hidden `select` that will trigger a real event | |
| // When `ReactSelect` triggers it's `onChange` we set the state with the `selectedOptions` | |
| // these `selectedOptions` will be what populate our hidden select. | |
| // Using the callback from `setState` (it ensures that the new values are already into our hidden select), | |
| // we then create a change event and dispatch it into our hidden select. | |
| // This will cause the `onChange` from this select to be triggered with a proper `event`. |
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
| from django.test import TestCase | |
| from authors.apps.authentication.models import User | |
| class TestUser(TestCase): | |
| def setup(): | |
| self.client = Client() | |
| self.username = 'kato' | |
| self.email = '[email protected]' | |
| self.password = '123456789' |