Skip to content

Instantly share code, notes, and snippets.

View PaulGwamanda's full-sized avatar
💭
Leave the world a little better than you found it

Paul Gwamanda PaulGwamanda

💭
Leave the world a little better than you found it
View GitHub Profile
@PaulGwamanda
PaulGwamanda / Remember Me Cookies
Created February 13, 2017 08:46
Remember Me Cookies for Ninja Forms + Mailchimp
<?php
/*
Plugin Name: Remember Me Cookies
Description: Remember Me Cookies for Ninja Forms + Mailchimp
Version: 1.0
*/
function ninja_forms_code()
{
//step 1
@PaulGwamanda
PaulGwamanda / export_job_manager_jobs.php
Created February 13, 2017 08:51
Export Jobs to HTML - Custom Bulk Action job manager wordpress theme -- modyfying custom bulk action
<?php
/*
Plugin Name: Export Jobs to HTML - Custom Bulk Action job manager wordpress theme -- modyfying custom bulk action
Description: Modifying Custom Bulk Action
Version: 1.0
*/
class THEME_Custom_Bulk_Action {
@PaulGwamanda
PaulGwamanda / slowdown-page-scroll
Created February 15, 2017 10:41
Slow down mouse-wheel on scroll by defined miliseconds, requires jquery easing plugin and jquery plugin, add script to main js file
// Slow down mouse-wheel by 1 second,
// add 200 pixels per-scroll
// with 150-pixel wheel-delta**/
if (window.addEventListener)
window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
function wheel(event) {
// set wheelDelta initial state to 0
@PaulGwamanda
PaulGwamanda / add-preloader.js
Created February 15, 2017 10:44
Add pre-loader before page load
/** Add pre-loader before page load **/
jQuery(document).ready(function ($) {
$(window).load(function () {
// on window load
setTimeout(function() {
//set timeout duration for preloader function
$(function (){
$('#preloader').fadeOut('3000', function () {
// fade out after 3 seconds
$(this).remove();
@PaulGwamanda
PaulGwamanda / bootstrap-active-menu-classes
Created February 15, 2017 10:44
Add bootstrap active menu classes
/** Add bootstrap active menu classes **/
$(".nav a").on("click", function () {
// find active menu
$(".nav")
.find(".active")
.removeClass("active");
// add active class
$(this)
.parent()
.addClass("active");
@PaulGwamanda
PaulGwamanda / collapse-all-bs-panels
Last active August 30, 2017 11:00
Collapse/Expand all panels on Single Click Event on panels
/** Collapse/Expand all bootstrap panels on Single Click Event on panels **/
$('#accordion .panel-default').on('click', function () {
$('#accordion .panel-collapse').collapse('toggle');
});
<div class="panel-group" id="accordion">
<!-- First Panel -->
<div class="panel panel-default">
<div class="panel-heading">
@PaulGwamanda
PaulGwamanda / jquery-numbers-count-up
Last active April 16, 2020 04:52
Jquery Count up numbers when scrolled into view
/** Jquery Count up numbers when scrolled into view
* <div class="col-lg-4 stats">
* <h3 class="">
* <span class="statvalue" numx="895"></span>
* </h3>
* <p class="lead">
* Since we started
* </p>
* </div>
@PaulGwamanda
PaulGwamanda / gist:01e43c1fba92d63b74d9b006b932b602
Created February 17, 2017 07:44
File upload field in a contact form - creates a folder and uploads to a directory and can be retrieved by calling the variable $img_link
$target_dir = "uploads/";
$temp = explode(".", $_FILES["fileToUpload"]["name"]);
$newfilename = rand(1, 99999) . '.' . end($temp);
$target_file = $target_dir . '' . $newfilename;
$uploadOk = 1;
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
@PaulGwamanda
PaulGwamanda / gist:e1e9def817071070b46e4daedc6e5081
Created February 17, 2017 08:14
Wordpress - build Theme options to insert each Social Media link and to output it in the theme
/**
* The list of Social Media options for the site
*
* This is used to build Theme options to insert each Social Media link and to output it in the theme
*
* @return array
*/
function cf_social_media_options()
{
return array(
@PaulGwamanda
PaulGwamanda / 3DCubeSlideshow.js
Last active August 16, 2017 13:52
3DCube Slideshow
// Codepen below
// https://codepen.io/paulgwamanda/pen/prdBzm
//Javascript for cube carousel slideshow animation
var myPresentation = function() {
var wrapper = null;
var defClass = null;
var slides = null;
var slidesNum = null;
var nextButton = document.createElement('a');