Detect the Content Type in the Clipboard / / No Comments A user’s clipboard is a “catch all” between the operating system and the apps employed on it. When you use a web browser, you can highlight text or right-click an image and select “Copy Image”. That made me think about how developers can detect what is in the clipboard. You can retrieve the contents of the user’s clipboard using the navigator.clipboard API. This API requires user permission as the clipboard could contain sensitive data. You can employ the following JavaScript to get permission to use the clipboard API: const result = await navigator.permissions.query({name: "clipboard-write"}); if (result.state === "granted" || result.state === "prompt") {... more → Posted in: JavaScript Tagged with: Clipboard, Content, Detect, type
Determine Default App for File Type from Command Line / / No Comments One quality of life improvement any developer can make for themselves is ensuring different file types open in the app they’re most proficient in. If you know me, you know I prefer accomplishing as much as possible from the command line. The duti utility allows users to determine default file type from command line. The duti utility allows developers to query which app is the default for different file types. You can install duti with brew: brew install duti Once you have duti available, you can check on the default app for file type with the following command: ~ duti -x md Xcode.app /Applications/Xcode.app com.apple.dt.Xcode You can set the default app by using its package: duti... more → Posted in: JavaScript Tagged with: Command, default, determine, file, from, line, type
Hegel, a New JavaScript Type Checker – InfoQ.com / / No Comments Hegel, a New JavaScript Type Checker InfoQ.com “JavaScript” – Google News… more → Posted in: JavaScript Tagged with: checker, Hegel, InfoQ.com, JavaScript, type