Skip to content

Instantly share code, notes, and snippets.

View johnpdang's full-sized avatar

jd johnpdang

  • San Diego, CA
View GitHub Profile
border:0px;
@johnpdang
johnpdang / gist:27c57e0eb33b3fb3203f
Last active August 29, 2015 14:27
Sublime User Preferences
{
"color_scheme": "Packages/LastNight2.tmTheme",
"ignored_packages":
[
"Vintage"
],
"soda_classic_tabs": true,
"soda_folder_icons": true,
"theme": "Soda Dark.sublime-theme"
}
@johnpdang
johnpdang / post-filtering.js
Last active May 9, 2020 23:35
Post Filtering
$(document).ready(() => {
if(!$('.alm-filter-nav').length){
return;
}
// Animation flag
var alm_is_animating = false;
// Set initial active item
document.querySelector('.alm-filter-nav li:first-child').classList.add('active'); // Set initial active state
const tabs = () => {
$(".nav-tabs a").click(function () {
$('.nav-tabs a').removeClass('active');
$(this).tab('show').blur().addClass('active');
const link_text = $(this).html();
const tab_trigger = $(this).closest('.tabs-dropdown-wrap').prev('.tab-dropdown-trigger');
tab_trigger.html(link_text);
if($(window).innerWidth() < 991){
$(this).closest('.tabs-dropdown-wrap').slideUp();
@johnpdang
johnpdang / package.json
Last active May 9, 2020 23:44
Webpack Config
{
"name": "dev",
"version": "1.0.0",
"description": "Requires at least: WordPress 4.7 Tested up to: WordPress 5.0-trunk Version: 1.0",
"main": "webpack.config.js",
"scripts": {
"build": "webpack",
"watch": "webpack --watch",
"dev": "webpack --watch --progress --mode=development",
"prod": "webpack --watch --mode=production"
@johnpdang
johnpdang / alm-filtering.js
Created May 10, 2020 00:11
Wordpress Ajax Load More advanced filtering with multiple custom taxonomies
// Advanced Filtering
$(document).ready(function () {
var alm_is_animating = false; // Animating flag
var buttons = $('.filter-tag .btn');
// Btn Click Event
$(document).on('click', '.filterTrigger .btn', function (e) {
e.preventDefault();
// Prevent any action while animating or with disabled class
@johnpdang
johnpdang / functions.php
Last active May 18, 2020 22:16
Browser and OS body classes
<?php
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
@johnpdang
johnpdang / .gitignore
Created August 21, 2020 16:54
Specifies intentionally untracked files to ignore
# OSX
.DS_Store
# windows
Desktop.ini
# ignore everything in the root except the "wp-content" directory.
!wp-content/
# ignore everything in the "wp-content" directory, except: