Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* This script convert a model using
* \October\Rain\Database\Traits\SimpleTree to
* \October\Rain\Database\Traits\NestedTree
*
* Before run create required fields in your DB for NestedTree
* ( https://octobercms.com/docs/database/traits#nested-tree )
*/
@softpunch
softpunch / colorVars.css
Last active June 14, 2022 06:44
CSS Variables For Color Manipulation
/* ----
css custom properties to manipulate color
MIT - 2017 - Soft Punch
https://gist.github.com/softpunch/
set initial "main" color via HSL values.
automatically calculate harmonies and variations of that color with pure css.
harmonies are determined solely by hue.
@amnuts
amnuts / ofilter.php
Last active June 21, 2024 01:42
Filter an array of objects based on property, or multiple property values
<?php
/**
* Filter an array of objects.
*
* You can pass in one or more properties on which to filter.
*
* If the key of an array is an array, then it will filtered down to that
* level of node.
*
@vojtasvoboda
vojtasvoboda / Plugin.php
Last active July 28, 2022 15:49
Extend backend form in OctoberCMS
<?php
public function boot()
{
// Extend all backend form usage
Event::listen('backend.form.extendFields', function($widget) {
// Only for the Posts controller
if (!$widget->getController() instanceof \RainLab\Blog\Controllers\Posts)
return;
@ternavsky
ternavsky / SerializableModel.php
Last active March 8, 2020 20:12
OctoberCMS Model behavior that allows to store some model's attributes in json format in grouping fields in db.
<?php namespace Path\To\Behaviors;
use System\Classes\ModelBehavior;
/**
* Model behavior that allows to store some model's attributes
* in json format in grouping fields in db.
*
* USAGE: In your model add
*
@Toddses
Toddses / index.html
Created March 25, 2015 16:51
jQuery MagicLine Using Transforms
<div class="nav-wrap">
<ul class="group" id="example-one">
<li class="current_page_item"><a href="#">Home</a></li>
<li><a href="#">Buy Tickets</a></li>
<li><a href="#">Group Sales</a></li>
<li><a href="#">Reviews</a></li>
<li><a href="#">The Show</a></li>
<li><a href="#">Videos</a></li>
<li><a href="#">Photos</a></li>
<li><a href="#">Magic Shop</a></li>
@daftspunk
daftspunk / DynamicModel.php
Created November 7, 2014 01:23
Dynamic OctoberCMS model
<?php namespace Acme\Blog\Models;
use Model;
/**
* DynamicModel Model
*/
class DynamicModel extends Model
{
@leongersen
leongersen / nouislider-inline.js
Last active August 28, 2020 07:43
A small handler to initialize noUiSlider with inline attributes. Implementation is roughly inspired by, but not fully compatible to, the specification for input[type="range"]. Attributes with or without the 'data-' prefix will be handled.
(function(){
'use strict';
$('[data-slider]').each(function(){
function d(a,b){
return parseFloat(a.attr(b) || a.attr('data-'+b));
}
@jareware
jareware / SCSS.md
Last active July 1, 2024 09:25
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso