March 19, 2024
  • March 19, 2024

Articles Posted by Johnny Thunder

NGINX Fonts Not Loading CORS

by on February 21, 2020 0
Sometimes when we are developing a website, the fonts wont load correctly.  This can look weird and especially so when we are using a font-based icon set like FontAwesome.  If you open up your dev console and see a lot of errors talking about CORS cross origin, you need to add a new header to [...] Read More

SPACED LETTERS

by on February 20, 2020 0
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz function spacedLetters(str) { var letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; var spacedLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; var resp = ''; for(var i = 0; i < str.length; i++) { var char = str[i]; var letInd = letters.indexOf(char); if(letInd != -1) { resp += spacedLetters[letInd]; } else { resp += char; } } return resp; } spacedLetters("Spaced Letters"); Read More

WEIRD ALL CAPS LETTERS

by on February 20, 2020 0
I saw a video on youtube with a title consisting of some strange typeface that really stood out. ABCDEFGHIJKLMNOPQRSTUVWXYZ   Here's a javascript function that will convert your text to these characters: function weirdLetters(str) { var resp = ''; for(var i = 0; i < str.length; i++) { var lettCode = str[i].toUpperCase().charCodeAt(0); if(lettCode < 65 [...] Read More

Debugging Errors in PHP and WordPress

by on February 20, 2020 0

Check your code on a php validator like PHP Code Checker   This code should be added at the top of a php file to show errors: error_reporting(E_ALL); error_reporting(-1); ini_set(‘error_reporting’, E_ALL);   If your on wordpress, make sure to enable debug mode in wp-config.php in the root of your site’s web directory: define( ‘WP_DEBUG’, true […]

Read More

Scaling Down Video Size

by on February 20, 2020 0
ffmpeg -i /home/vids/vid.mp4 -vf "[in] scale=1280:720, fps=fps=8" /home/vids/vid_sml.mp4 Many times, video hosting sites have limits to how large a video is.  Also, we may want to use lighterweight videos for components in our sites.  Here is some code that can help your downscale your video dimensions and frame rate: Downsizes the framerate to 8fps and [...] Read More

How To Make Audio/ Video Louder or More Quiet With ffmpeg/ avlib

by on February 1, 2019 0

Louder: ffmpeg -i Mandolin.mp3 -filter:a “volume=+10dB” MandolinLoud.mp3   Quieter: ffmpeg -i Mandolin.mp3 -filter:a “volume=-10dB” MandolinLight.mp3     Ex: Make Video Louder ffmpeg -i Mandolin.mp4 -filter:a “volume=+10dB” MandolinLoud.mp4 If you get a warning error that says: The encoder ‘aac’ is experimental but experimental codecs are not enabled, add ‘-strict -2’ if you want to use it.… […]

Read More

Merge pdfs In Linux

by on January 20, 2019 0
It's often useful to merge multiple pdf files in a single pdf file.  I recently had to do this to merge all my monthly statements into a single pdf to print. Let's take an example where we have a folder full of pdfs in /usr/myPdfs and we want to merge them all together. First, let's get [...] Read More