Here, you’ll find chunks of PHP, MySQL, HTML, jQuery, JavaScript, and Ajax code that we’ve put together while working through various projects. Hopefully they’ll help you out in your coding adventures too. Displaying posts 1 through 25 of 98:

Include JavaScript and CSS Files for a Single Page in Drupal 8

CSS | Drupal | JavaScript | jQuery
Here’s how to include JavaScript and CSS files for a single node on your Drupal 8 site, without having them load on every page. » View Post

$(window).load Is Deprecated

JavaScript | jQuery
The .load handler was removed in jQuery 3.0. Here’s the code to use instead. » View Post

Use .htaccess to Prevent WP-Admin Access on Local and Staging

Here’s an easy trick that will keep you from accidentally editing posts and pages on the wrong version of your site. » View Post

Fade Between Images with jQuery

JavaScript | jQuery | PHP
With this PHP function, you can fade directly from one image to another with jQuery, and even make a looping slideshow. Super easy. » View Post

How To Set Up a Local WordPress Environment Without Using a Plugin

You need a local dev environment. You need a staging environment. You don’t want to install another plugin. This tutorial will help. » View Post


A bunch of common web fonts with a wacky backup font in place so that it’s obvious if your browser isn’t loading up the intended one. » View Post

Bookmarklet to Grab Query String Data

JavaScript bookmarklet code that grabs all the parameters from the query string and places their data into the text fields by ID. » View Post

How to Remove Decimals from Prices in BigCommerce

BigCommerce | CSS | JavaScript | jQuery
jQuery script that removes the decimal places from prices, and instructions on how to install it to your BigCommerce store. » View Post

Get Access to IFrame Elements with JavaScript

Using a little JavaScript magic, you can target the iframe’s elements just like you would any element in the main page. » View Post

PHP Content-Type Headers

A list of commonly used HTTP headers, pre-formatted as PHP code for quick copying and pasting. » View Post

JavaScript Equivalent of PHP’s ucwords Function

This JavaScript function takes a string, converts it to lowercase, then capitalizes the first letter of each word. » View Post

Why is jQuery Not Working in Drupal 8?

Drupal | JavaScript | jQuery
Here’s a quick hack to get around the problem. » View Post

Collect and Save Electronic Signatures

JavaScript | PHP
This simple example will show you exactly how to collect an electronic signature from your users and save it as a PNG file using PHP. » View Post

Get and Set Query String Variables with JavaScript

Quick functions that will let you both get data from the query string in JavaScript, and also to update that query string. » View Post

Get File Size and File Name of Local Files with JavaScript

JavaScript | jQuery
With the HTML5 File interface, you can access filename and size of users' files — before they're uploaded. Here's how. » View Post

Is Facebook Spying on Our iPhone Photos?

Connecting the dots between a snapped cell phone photo and the same product in a Facebook ad. » View Post

Send Email via SMTP from PHP Using PEAR

Email | PHP
A more secure alternative to using PHP’s mail() function that will help keep your messages out of the spam filters. » View Post

Get Redirect URL with PHP

This function follows redirects (even multiple redirects) and returns the final destination URL as a string. » View Post

Scroll to Div with jQuery

JavaScript | jQuery
Find the top of an element on your page and scroll to it (without animation) using jQuery. » View Post

List of PHP Supported Time Zones

Data Dumps | PHP
An easy-to-copy display of all the supported zones, plus code that you can use to create your own dynamic list and HTML to populate a dropdown. » View Post

Regex Checking of Foreign Characters in PHP

How to handle extended characters (like the é in café) with regular expressions. » View Post

Set Colors of Links Within Bootstrap Alerts

Bootstrap | CSS
Bootstrap’s alerts work great, but links within them don’t match. This CSS changes that. » View Post

Zoom in on Hover with CSS

Use CSS to zoom in when a user hovers over div or image (and keep it from expanding). » View Post

Responsive Parallax Images

A quick tutorial on creating parallax images that scale down for mobile screens with CSS and jQuery. » View Post

Fade Between Two Backgrounds

CSS | JavaScript | jQuery | TweenMax
Using CSS and JavaScript, fade between two background images. Includes a working example. » View Post
» Next · End · Categories