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
#!/bin/sh | |
# replace audio in a video file without re-encoding the video | |
# based on https://superuser.com/a/1096239 | |
# CLI usage: ./replace-audio.sh video.mp4 audio.mp4 output.mp4 | |
# interactive usage: run script, enter filenames when asked, confirm with ENTER | |
function run() { |
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
// see https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API | |
/** @private */ | |
const ERR_NO_API = 'The Fullscreen API not supported on this device'; | |
export function requestFullscreen(elem) { | |
if (elem.requestFullscreen) { | |
elem.requestFullscreen(); | |
} else if (elem.msRequestFullscreen) { | |
elem.msRequestFullscreen(); |
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
let query = bp.database('web_messages') | |
if (bp.database.isLite) { | |
query | |
.where('attr_fookey', 'like', `%foo_value%`) | |
.select(bp.database.raw(`web_messages.id, json_extract(web_messages.payload, '$.foo') as attr_fookey`)) | |
} else { | |
query.whereRaw(`web_messages.payload ->>'foo' like '%foo_value%'`) | |
query.select(this.knex.raw(`web_messages.id`)) | |
} |
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
#!/bin/sh | |
# finds node packages installed in a given directory | |
# - takes a directory path and one or more package names | |
# - finds all package.json files in the directory that have a matching name | |
# - returns the paths to the package folders | |
# | |
# Usage example: | |
# | |
# $ find_installed_packages.sh ./project/.cache/ foo foo-utils |
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
# Reason 11 eats up lots of space for content files | |
# An easy solution is to move the contents to another drive and create symlinks to the new locations | |
# --- These steps/commands are for Windows --- | |
mkdir D:\Reason\_symlinks\AppData | |
mkdir D:\Reason\_symlinks\ProgramData | |
mkdir D:\Reason\_symlinks\UserData | |
mv "%USERPROFILE%\AppData\Roaming\Propellerhead Software" "D:\Reason\_symlinks\AppData" | |
mv "%USERPROFILE%\Music\Propellerhead Content" "D:\Reason\_symlinks\UserData" |
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
/** | |
* example of making inspector menu item available on everything from the "root" component | |
*/ | |
import { hot } from 'react-hot-loader/root'; | |
import React from 'react'; | |
import useContextMenu from './hooks/use-context-menu'; | |
const App: React.FC = React.memo(() => { |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) |
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
# just delete all node_modules recursively without reinstalling | |
alias delete-node-modules='find . -name node_modules -type d -exec rm -rf "{}" + ' | |
# delete all node_modules and reinstall via npm | |
nuke-npm() { | |
if [ "$1" == "-f" ]; then | |
rm -f package-lock.json | |
fi | |
find . -name node_modules -type d -exec rm -rf "{}" + | |
npm install |
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
// ------------------------------------------------------------------------ | |
// | |
// @mixin variate($style, $sizes, $variations, $withUnits) | |
// | |
// creates a list of shortcut utitlity classes, with variations for each side | |
// | |
// Usage: | |
// | |
// variate(margin); | |
// variate(margin, (0em, 6em, 12em, 24em, 48em)); |