CSS Modules lets you write and use simple class names rather than remembering and maintaining long unique class names for every component. CSS Modules mutates all of your classnames from each partials into new, completely unique classnames that will not conflict when they are bundled together into your main CSS file. Then, a JSON file is generated that maps the happy classnames from each file to the unique classname in the combined file. You load this map in PHP, and begin using the easy-to-remember classnames as you wish.
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "darken(#428bca, 6.5%)", | |
"@brand-success": "#5cb85c", |
// ==UserScript== | |
// @name RedaddCSS | |
// @namespace com.digitalfishfun.nosteponcss | |
// @version 1 | |
// @grant none | |
// @include https://reddit.com/r/* | |
// ==/UserScript== | |
const nosteponcss_instructions = ` | |
USAGE: |
<?php | |
$this->respond( | |
'/?', function ($req, $res, $service, $app) { | |
return "home page for SUBDOMAIN"; | |
} | |
); |
<?xml version="1.0" encoding="UTF-8"?> | |
<TaskOptions> | |
<TaskOptions> | |
<option name="arguments" value="-I ~/Software/compass-mixins-master/lib/ scss/$FileName$ css/$FileNameWithoutExtension$.css" /> | |
<option name="checkSyntaxErrors" value="true" /> | |
<option name="description" value="Compiles .scss files into .css files using SassC" /> | |
<option name="exitCodeBehavior" value="ERROR" /> | |
<option name="fileExtension" value="scss" /> | |
<option name="immediateSync" value="false" /> | |
<option name="name" value="sassc compass" /> |
function displayTime() { | |
var time = moment().format('HH:mm:ss'); | |
$('#clock').html(time); | |
setTimeout(displayTime, 1000); | |
} | |
$(document).ready(function() { | |
displayTime(); | |
}); |
<?php | |
function route($pattern, $controller) | |
{ | |
return function($query) use($pattern, $controller) { | |
return (($matches = route_match($pattern, $query)) === false) ? | |
false : | |
function($registry) use($matches, $controller) { | |
return $controller($matches, $registry); | |
} | |
; |
Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.
This script currently lacks the support for alpha-transparency that Lea supports in her script though.
In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.
Normal usage: `color: pick_best_color(#f00
# HTTP Status Cats | |
# Apache (htaccess) config originally created by @dave1010, | |
# rebuilt by Sarah Pierce (see modifications section) | |
# Licensed CC BY 2.0 | |
# Images CC BY 2.0, from GirlieMac's photostream: | |
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/ | |
# Usage: copy save this file as .htaccess or add it to your httpd.conf |
<?php | |
/** | |
* Form Class | |
* | |
* Responsible for building forms | |
* | |
* @param array $elements renderable array containing form elements | |
* | |
* @return void |