Skip to content

Instantly share code, notes, and snippets.

@jenhuls
jenhuls / maintenance-redirection-function.php
Created November 16, 2022 15:38
[Maintenance Redirect Function] #WordPress
function maintenance_redirect(){
if( !is_user_logged_in() ){
wp_redirect( site_url( 'maintenance.html' ), 302 );
exit();
}
}
add_action( 'init', 'maintenance_redirect' );
@jenhuls
jenhuls / lineawesomepseudo.css
Created November 11, 2022 16:52
[Line Awesome Pseudo Element] #css
content: "\f105";
font-family: 'Line Awesome Free';
font-weight: 900;
@jenhuls
jenhuls / addClass-on-scroll.js
Created May 17, 2022 13:20
[Add Class to Header on Scroll] #jquery #pinned
(function($) {
$(window).scroll(function() {
var header = $(document).scrollTop();
var headerHeight = $(".header").outerHeight();
if (header > headerHeight) {
$(".header").addClass("fixed");
} else {
$(".header").removeClass("fixed");
}
});
@jenhuls
jenhuls / init-modal.js
Last active April 15, 2022 12:28
[Simple Modal] #js
/* jshint esversion: 6 */
// @link: https://screenspan.net/blog/multiple-modals/
// Get each modal and close button
const triggers = document.getElementsByClassName("trigger");
const triggerArray = Array.from(triggers).entries();
const modals = document.getElementsByClassName("modal");
const closeButtons = document.getElementsByClassName("btn-close");
// Then use `for...of`-loop with the index of each item in `triggerArray` for listening to a click event which toggles each modal to open and close
for (let [index, trigger] of triggerArray) {
@jenhuls
jenhuls / text-to-titlecase.js
Created March 27, 2022 09:50
[jQuery Text to Title Case] #jquery
(function($) {
$.fn.toTitleCase = function() {
return $(this).each(function() {
var ignore = "and,the,in,with,an,or,at,of,a,to,for".split(",");
var theTitle = $(this).text();
var split = theTitle.split(" ");
for (var x = 0; x < split.length; x++) {
if (x > 0) {
if (ignore.indexOf(split[x].toLowerCase()) < 0) {
@jenhuls
jenhuls / _flexbox.scss
Created March 26, 2022 12:49 — forked from francajosejunior/_flexbox.scss
SCSS helpers
// Flexbox Mixins
@mixin flexbox {
display: -webkit-box;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
}
@jenhuls
jenhuls / read-more.css
Last active March 17, 2022 17:17
[jQuery Read More] #jquery
.description .more--content span {
display: none;
}
.description .more--link {
display: block;
}
@jenhuls
jenhuls / prevent-double-border.scss
Created January 31, 2022 02:16
[Prevent Double Border in Grid Layout]#scss
/*
* example usage: client logo grid
*/
.item {
border: 1px solid $gray-200;
margin:0 -1px -1px 0;
}
@jenhuls
jenhuls / margins-padding-width-mixin.scss
Last active January 29, 2022 19:30
[Dynamic Widths, Padding & Margins Sass Mixin] Allows for multiple units of measure including rem, %, px, ch, vh & vw. #scss
// =============================================================================================
// ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████
// ██ ██ ██ ██ ████ ██ ██ ██ ████ ████ ██ ██
// ██ ██ ████ ██ ██ ██ ███████ ██ ████ ██ ██ ██
// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
// ██████ ██ ██ ████ ██ ██ ██ ██ ██ ██████
// ██████ █████ ██████ ██████ ██ ███ ██ ██████
// ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██
// ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███
// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@jenhuls
jenhuls / dummy-form.html
Last active January 18, 2022 12:12
[PHP Contact Form w/ AJAX] #jquery #php #html
<div class="contact container shadow" id="contact_form">
<div class="contact row header">
<h2>CONTACT US</h2>
<h3>Request information, book a studio, or plan your event!</h3>
<div id="contact_results"></div>
</div>
<div class="contact row body" id="contact_body">
<div class="contact-elements">
<ul>
<li>