Skip to content

Instantly share code, notes, and snippets.

Working from home

Joseph VanTine thebigtine

Working from home
View GitHub Profile
View responsive-logo-04.html
<svg width="100%" height="100%" xmlns="" xmlns:xlink="">
.landscape { visibility: hidden; }
.portrait { visibility: visible; }
@media (min-aspect-ratio: 1/1) {
.landscape { visibility: hidden; }
.square { visibility: visible; }
cferdinandi / myplugin-media.js
Last active Nov 29, 2021
Adding a Media Uploader to a custom metabox
View myplugin-media.js
* Load media uploader on pages with our custom metabox
'use strict';
// Instantiates the variable that holds the media library frame.
var metaImageFrame;
jazibsawar / delete_custom_post_type.php
Created Oct 2, 2017
WordPress $wpdb: Delete all posts of a custom post type with its associated meta data (taxonomies, post meta) using SQL query & $wpdb
View delete_custom_post_type.php
function delete_custom_posts($post_type = 'post'){
global $wpdb;
$result = $wpdb->query(
DELETE posts,pt,pm
FROM wp_posts posts
LEFT JOIN wp_term_relationships pt ON pt.object_id = posts.ID
LEFT JOIN wp_postmeta pm ON pm.post_id = posts.ID
WHERE posts.post_type = %s
kstover / nf-after-load.js
Created Nov 10, 2016
Ninja Forms Three - After a form has loaded
View nf-after-load.js
// Create a new object for custom validation of a custom field.
var nameSpaceController = Marionette.Object.extend( {
initialize: function() {
this.listenTo( 'form' ), 'render:view', this.doCustomStuff );
doCustomStuff: function( view ) {
var formModel = view.model; // formModel will be a Backbone model with all of our form data.
var formID = formModel.get( 'id' ); // We can use .get( 'setting' ) get get any of our form settings.
joseluisq /
Last active Nov 27, 2021
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)


Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
dylanvalade / jquery-center-vertical.js
Last active Sep 20, 2016
Center child element vertically within parent with jQuery
View jquery-center-vertical.js
// child: jquery object e.g $(".active .slide-caption")
// parent: jquery object e.g $(".active.slide")
// property (string): CSS property to change depending on your CSS positioning e.g. "top", "margin-top" or "bottom"
function centerVertical(child, parent, property) {
var parentHeight = parent.height(),
childHeight = child.height();
// Handle edge cases with padding or margins affecting child.height() calculation
if (child.find("h1").length) {
spigotdesign / user-profile-picture.php
Last active Aug 22, 2021
Add WordPress image uploader to user profile.
View user-profile-picture.php
* Add custom user profile information
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
DHS / PHP Countries Array
Created Nov 4, 2011
PHP array of all country names
View PHP Countries Array
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island