Skip to content

Instantly share code, notes, and snippets.

View lvl99's full-sized avatar

Matt Scheurich lvl99

View GitHub Profile
@lvl99
lvl99 / 07-Composable-mixin-piece-variables.less
Created April 7, 2017 13:56
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Uses the namespace to build custom state classes
@-toggleable-ns-class-show: ~".ui-@{ns}-show";
@-toggleable-ns-class-hide: ~".ui-@{ns}-hide";
@lvl99
lvl99 / 08-Composable-mixin-piece-nested-mixins-defining-classes-and-states.less
Created April 7, 2017 13:57
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Class mixin which contain style definitions for `show` state
.-toggleable-class-show(@rules: {}) {
display: @-toggleable-display;
@rules();
}
// Class mixin which contains style definitions for `hide` state
.-toggleable-class-hide(@rules: {}) {
display: none;
@rules();
@lvl99
lvl99 / 09-Composable-mixin-piece-init-default-configuration.less
Created April 7, 2017 13:57
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Special mixin to apply any default state styles and rules
.-toggleable-init-default(@rules: {}) {
.-toggleable-state-show();
.-toggleable-state-hide();
@rules();
}
@lvl99
lvl99 / 10-Example-Modal-composable-mixin-class-(simple).less
Created April 7, 2017 13:57
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Modal Mixin Class
// @param @ns Namespaces the custom state classes
.ui-lvl99-modal(@ns: ~"lvl99-modal") {
.ui-lvl99-toggleable(@ns);
.-modal-init-default(@rules: {}) {
.-toggleable-init-default(@rules);
}
}
@lvl99
lvl99 / 11-Example-Modal-composable-mixin-class-(complex).less
Created April 7, 2017 13:57
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Modal Mixin Class
// @param @ns Namespaces the custom state classes
.ui-lvl99-modal(@ns: ~"lvl99-modal") {
.ui-lvl99-toggleable(@ns);
// Special mixin to apply any rules to the default class
// If you feel you wouldn’t need to reuse this class definition in other components, you could
// just define it in the main body of the mixin class definition
.-modal-class-default(@rules: {}) {
position: fixed;
@lvl99
lvl99 / 12-Example-instantiating-Modal-composable-mixin-into-component-class.less
Created April 7, 2017 13:58
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
.modal {
.ui-lvl99-modal(@ns: ‘modal’);
.-modal-init-default({
background: red;
padding: 40px;
});
}
// ... would output the following CSS
.modal {
@lvl99
lvl99 / bootstrap.before.php
Created April 29, 2017 15:49
Vanilla ForumsHow one can support multiple configuration options depending on the server/hostname/etc.
<?php
// Detect any specific server environment config setup to apply
// Default: development
$server_environment = 'development';
if ( ! empty( $_SERVER['HTTP_SERVER_ENVIRONMENT'] ) ) {
$server_environment = $_SERVER['HTTP_SERVER_ENVIRONMENT'];
}
// Load the server environment config
@lvl99
lvl99 / 01-tiled-gallery-carousel-image-args.php
Last active July 26, 2017 11:01
Use Fancybox instead of Jetpack's Carousel to display images in a lightbox