Skip to content

Instantly share code, notes, and snippets.

View richjenks's full-sized avatar
🏍️

Rich Jenkins richjenks

🏍️
View GitHub Profile
@richjenks
richjenks / snow.js
Last active December 2, 2019 13:17
(function () {
var snowflakes = [],
moveAngle = 0,
animationInterval;
/**
* Generates a random number between the min and max (inclusive).
* @method getRandomNumber
* @param {Number} min
* @param {Number} max
@richjenks
richjenks / vue.config.js
Created November 29, 2019 14:56
Serve a Vue project in a subdirectory based on environment
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/dist/' : '/'
}
@richjenks
richjenks / wp-find-replace-sh
Created April 16, 2019 15:11
Find-and-replace in a WP database on Pantheon
terminus wp vzaar.test -- search-replace vzaar.com qavzr.com --dry-run
@richjenks
richjenks / README.md
Created April 12, 2019 11:41
Webpage Data to TSV

Webpage Data to TSV

Copy data from a webpage to your clipboard so it's ready to be pasted into a spreadsheet.

For example, say there are a list of links on a page and you want to get the ID, link text, and href.

All we're doing is iterating through each item, constructing a series of tab-separated value rows and copying it to the clipboard.

Make sure each item is separated with a tab and each row is terminated with a newline.

@richjenks
richjenks / ffmpeg-folder.bat
Created October 6, 2018 13:14
Convert an entire folder with ffmpeg
for %A IN (*.m4b) DO ffmpeg -i "%A" "%%A.mp4"
@richjenks
richjenks / check-cookie-exists.js
Created October 1, 2018 09:22
One-line check for whether a given cookie name exists
add_action('after_setup_theme', function () {
remove_action('init', 'portfolio_register');
});
@richjenks
richjenks / ffmpeg-gifv.sh
Last active June 30, 2018 08:20
Takes a video, removes the audio and compresses the sh!t out of it
ffmpeg -i input.mkv -an -preset veryslow -c:v h264 output.mp4
@richjenks
richjenks / ffprobe-video-audio-codec.sh
Created March 25, 2018 16:25
Get the video/audio codec of the first stream in a video file
# Video
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 input.mp4
# Audio
ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 input.mp4
@richjenks
richjenks / webpack.min.js
Created February 18, 2018 11:49
Append this to `webpack.min.js` > run `php artisan serve` > run `npm run watch` > profit
mix.browserSync({
proxy: '127.0.0.1:8000',
notify: false
});