JavaScript Canvas getImageData Pixel Colors Slightly Off in Firefox
Dec 3, 2023Programming
Browser fingerprinting protection can cause the RGB values of image data returned by context.getImageData() to be randomly off by a little bit (usually -1 or 1). So instead of solid black being rgba(0, 0, 0, 255) as expected, it might be rgba(0, 1, 0, 255) or similar.
Continue Reading ›
How to use FedEx API with PHP Examples
Feb 16, 2023ProgrammingComments (5)
Here's a guide on how to get set up with the FedEx API and start making requests. I've included PHP code examples for retrieving tracking data using the Track API, but it can be adapted to any language and other FedEx APIs. This guide assumes you have decent knowledge on handling JSON objects and making HTTP requests.
Continue Reading ›
PHP Get US Holidays for Multiple Years
Feb 14, 2023Programming
Here is a simple PHP script that generates US holidays for multiple years in YYYY-MM-DD format, and stores them in a basic array. Note that due to timezone differences, this may create unexpected results within 24 hours of a new year for users that are in different timezones.
Continue Reading ›
How to Handle Android Back Button Event in C# Unity Game Engine (Quit, Pause, Etc)
Nov 23, 2017ProgrammingComments (7)
In Unity, the Android back button is treated the same as the "Escape" KeyCode. So in order to do something when the user presses the back button on their Android device, you need to check for the Escape key being pressed down and also make sure the user is on the Android platform (if you're cross-platform).
Continue Reading ›
Magento 2 M2E Pro Shipping Policy Bug Unknown Modifier H
Jul 19, 2017Programming
When attempting to edit or create an eBay Shipping Policy in M2E Pro for Magento 2, you may come across an error like this:
Continue Reading ›
Unity 2D Particle System Inward Moving Particles
May 16, 2017ProgrammingComments (3)
To create inward-moving particles using the stock Particle System in Unity, you need to set the Start Speed to a negative number. This reverses the direction of the particles so they move towards the center.
Continue Reading ›
Create a Self-Signed SSL Certificate using OpenSSL on Windows
May 12, 2017Programming
This is a simple method for creating a self-signed SSL certificate on Windows. This is useful for testing and development purposes; you shouldn't use a self-signed SSL certificate on a production website.
Continue Reading ›
PHP Amazon S3 File Upload Code AWS Signature Version 4
Apr 12, 2017ProgrammingComments (9)
Amazon offers a PHP SDK for handling AWS and S3 requests, but it weighs in at over 500 files and nearly 5MB. If you just want to upload a file to an S3 bucket using PHP, you can create the HTTP POST request yourself using only about 50 lines of code. This is also useful if you want to understand how the request and authorization process work.
Continue Reading ›
Create 2D Mesh Outline in Unity (Silhouette)
Mar 6, 2017ProgrammingComments (2)
This code creates an outline of a 2D mesh utilizing the LineRenderer component in Unity. It does not require any shaders and seems to run very quickly from my testing. It also supports meshes that have mutliple non-connected components.
Continue Reading ›
JavaScript Static Properties and Methods
Sep 28, 2016Programming
Here is a very simple example on using static properties and methods (variables and functions) with JavaScript.
Continue Reading ›
Automatically Create Polygon Collider 2D From 2D Mesh in Unity
Sep 6, 2016ProgrammingComments (14)
I was working on a 2D game in Unity and needed some way to automatically create a collider for a complex 2D level mesh. Editing a Polygon Collider 2D in the editor was out of the question, since there were thousands of vertices. I ended up writing a script that analyzes the MeshFilter of the mesh, and programmatically creates a Polygon Collider 2D for it. It also supports meshes that have mutliple non-connected components.
Continue Reading ›
Simple PHP Code for Uploading a File to an Amazon S3 Bucket - Signature Version 2
Sep 2, 2016ProgrammingComments (4)
Note: This code uses Amazon AWS Signature Version 2, which is not available on any S3 Regions created after January 30, 2014. It is recommended to use Version 4. Please view the AWS Version 4 post here.

--------------------

Amazon offers a PHP SDK for handling AWS and S3 requests, but it weighs in at over 500 files and nearly 5MB. If you just want to upload a file to an S3 bucket using PHP, you can create the HTTP POST request yourself using only about 30 lines of code. This is also useful if you want to understand how the request and authorization process work.
Continue Reading ›
Workaround to Windows SourceTree 1.6.24 Continually Asking For Password
Nov 30, 2015ProgrammingComments (2)
If you've updated to SourceTree 1.6.24 on your Windows computer and it keeps asking for a password, here is one potential workaround/solution that may work for you.
Continue Reading ›
How to use X-Sendfile with PHP and Apache
Apr 10, 2015Programming
X-Sendfile allows you to use PHP to instruct the server to send a file to a user, without having to load that file into PHP. It solves the problem of securely managing file access, without the excessive memory requirement of loading the file and reading it from PHP.
Continue Reading ›
NewerPage 1Older