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
#!/usr/bin/env osascript -l JavaScript | |
/* | |
osascript -l JavaScript <this-file.js> | |
see https://github.com/JXA-Cookbook/JXA-Cookbook/wiki/ | |
*/ | |
const System = Application('System Events') | |
const Terminal = Application('Terminal') |
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
[2023-01-01 23:25:00] DELETE /logout 453 | |
[2023-01-11 20:56:00] GET /settings 121 | |
[2023-01-08 18:51:00] POST /dashboard/85 11 | |
[2023-01-12 11:00:00] DELETE /settings 68 | |
[2023-01-12 11:00:00] WARNING Memory usage is high. | |
[2023-01-12 11:00:00] DETAILS Current usage: 85%, Threshold: 80% | |
[2023-01-11 20:06:00] GET /profile 278 | |
[2023-01-04 17:19:00] GET /dashboard/12/overview 65 | |
[2023-01-04 00:16:00] GET /home 477 | |
[2023-01-01 04:18:00] POST /settings 434 |
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 templatized = (template, vars = {}) => { | |
const handler = new Function('vars', [ | |
'const tagged = ( ' + Object.keys(vars).join(', ') + ' ) =>', | |
'`' + template + '`', | |
'return tagged(...Object.values(vars))' | |
].join('\n')) | |
return handler(vars) | |
} |
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
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: '{AWS_KEY}', | |
secretAccessKey: '{AWS_SECRET}', | |
region: '{SNS_REGION}' | |
}); | |
var sns = new AWS.SNS(); |
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
/* | |
see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon | |
```jsx | |
const MyComponent = ({ children }) => { | |
// will get fired if the page unloads while the component is mounted | |
useUnloadBeacon({ | |
url: 'https://api.my.site/route', | |
payload: () => { | |
return 'something' |
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 { useEffect, useState } from 'react' | |
/* | |
takes in a string and returns a hash int code | |
which can be useful for generating react keys | |
base on input strings, that may or may not change | |
const [hashCode, setHashCodeString] = useHashCode() | |
*/ |
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
/* | |
This hook will trap tabbing within a component. | |
A common usecase is a Modal, in which you want tabbing to keep focus within the modal. | |
This assumes that any custom `tabindex` prop is either `0` (should be tabbable, no order preference) | |
or `-1` (not tabbable, should skip). Anything like `tabIndex={2}` will not get ordered correctly. | |
It will skip over disabled inputs. | |
--- |
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
INCOGNITO=false | |
LOW_BANDWIDTH=true | |
PLAY_SOUND="/your/mp3.mp3" | |
SHOW_ONLY_SERIES="sonyps5c,sonyps5de,xboxss,xboxsx" | |
STORES="target,walmart,xbox,amazon,antonline,bestbuy,playstation" |
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
{ | |
"editor.tabSize": 2, | |
"window.zoomLevel": 0, | |
"editor.snippetSuggestions": "none", | |
"editor.parameterHints.enabled": false, | |
"editor.suggest.snippetsPreventQuickSuggestions": false, | |
"html.suggest.html5": false, | |
"editor.hover.enabled": false, | |
"editor.codeActionsOnSave": null, | |
"javascript.autoClosingTags": false, |
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
syntax on | |
colorscheme desert | |
set encoding=utf8 | |
filetype plugin on | |
filetype indent on | |
" Avoid garbled characters in Chinese language windows OS | |
let $LANG='en' | |
set langmenu=en |
NewerOlder