Skip to content

Instantly share code, notes, and snippets.

View design-innovations's full-sized avatar

Jonathan Shroyer design-innovations

View GitHub Profile
@design-innovations
design-innovations / rgb-rainbow-background.css
Created July 29, 2021 20:00
CSS - RGB Rainbow Background
.rgb::after {
content:"";
background: linear-gradient(45deg,
#ff0000 0%,
#ff9a00 10%,
#d0de21 20%,
#4fdc4a 30%,
#3fdad8 40%,
#2fc9e2 50%,
#1c7fee 60%,
.fab-four {
--threshold: 600px;
--gap: 1rem;
--items: 3;
--gap-spacing: calc(var(--gap) * (var(--items) - 1));
display: flex;
flex-flow: row wrap;
gap: var(--gap);
}
@design-innovations
design-innovations / tailwind-typography-set-defaults.js
Last active May 28, 2021 16:33
Tailwind - Set Typography Plugin Defaults
// Note: This uses custom colors so it will scream at you if you use as-is
extend: {
typography: (theme) => ({
DEFAULT: {
css: {
color: theme('colors.gray.800'),
a: {
color: theme('colors.peach.900'),
'&:hover': {
color: theme('colors.peach.700'),
@design-innovations
design-innovations / alpine-scroll-fixed-header.js
Created May 26, 2021 14:40
Alpine - Scroll detection - fixed header
<div x-data="{ scrollAtTop: true }">
<nav
class="p-4 w-full fixed"
:class="{ 'bg-white shadow-md' : !scrollAtTop }"
@scroll.window="scrollAtTop = (window.pageYOffset > 50) ? false : true"
>
Header - Menu Bar
</nav>
</div>
@design-innovations
design-innovations / pages-navigation.php
Last active May 25, 2021 03:46
Pages - Navigation
This partial can create an unlimited hierarchical menu. The active menu is activated using a active-child class,
the parent and grandparents of the active menu get a child-is-active class.
Getting the items:
Pages
The starting folder can be configured using the $foldervariable, if not defined the root will be used and the
depth using the $levelvariable, if not defined the menu will render the complete pages tree.
<? $items = collection('pages', ['folder' => $folder ?? '.', 'level' => $level ?? null, 'recurse' => 'true']) ?>
@design-innovations
design-innovations / flex-to-table-for-ie
Created May 24, 2021 21:38 — forked from waseemsadiq/flex-to-table-for-ie
tailwind .flex to IE friendly code for dummies
/* IE9, IE10, IE11 | see: https://stackoverflow.com/a/30743013 */
@media screen and (min-width:0\0) {
.flex {
display:table;
width:100%;
}
.flex > div {
display:table-cell;
}
}
@design-innovations
design-innovations / .htaccess
Created May 13, 2021 22:06 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@design-innovations
design-innovations / pages-log-exceptions-errors.php
Created May 12, 2021 13:30
Pages - Log exceptions and errors
<?php
/*
From https://github.com/joomlatools/joomlatools-pages/discussions/692
Exceptions in Pages are exposed as events, meaning that you they can be easily intercepted them through event subscribers. This allows for a whole lot of flexibility. Based on the type of exception different event handlers could do different things, for example;
handling 404 not found exceptions
handling error logging
rendering debug information
Basic exception event subscriber
@design-innovations
design-innovations / pagination.php
Created May 7, 2021 23:54 — forked from franz-josef-kaiser/pagination.php
WordPress pretty Pagination with first/last, next/prev and range parameters above/below current page
- MOVED -
Can now be found in a repository incl. license, readme, styles and plugin php file: https://github.com/franz-josef-kaiser/Easy-Pagination-Deamon
@design-innovations
design-innovations / wp-leadingslash.php
Created May 6, 2021 17:16 — forked from mcaskill/wp-leadingslash.php
WordPress \ Formatting : Prepends a leading slash and removes leading forward slashes and backslashes if they exist.
<?php
/**
* Prepends a leading slash.
*
* Will remove leading forward and backslashes if it exists already before adding
* a leading forward slash. This prevents double slashing a string or path.
*
* The primary use of this is for paths and thus should be used for paths. It is
* not restricted to paths and offers no specific path support.