Some key quotes:
SMACSS has two core goals: 1. Increase the semantic value of a section of HTML and content. 2. Decrease the expectation of a specific HTML structure.
SMACSS is about identifying the patterns in your design and codifying them.
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
</head> | |
<body> | |
<div id="animals" data-animals='["cat", "dog", "bird"]'></div> | |
<div id="vehicles" data-vehicles='{"motorcycle":"Harley", "car":"Herbie", "steamshovel":"Mike"}'></div> |
def convert_to_brightness_value(background_hex_color) | |
(background_hex_color.scan(/../).map {|color| color.hex}).sum | |
end | |
def contrasting_text_color(background_hex_color) | |
convert_to_brightness_value(background_hex_color) > 382.5 ? '#000' : '#fff' | |
end |
@-webkit-keyframes rainbow { | |
0% {border-color: hsl(0, 100%, 50%);} | |
100% {border-color: hsl(255, 100%, 50%);} | |
} | |
.rainbow_border{ | |
border: 4px solid hsl(0, 100%, 50%); | |
-webkit-animation: rainbow 5s infinite alternate; | |
} |
<div | |
id="grid" | |
style={{ | |
backgroundSize: '8px 8px', | |
backgroundPosition: '50%', | |
backgroundImage: | |
' | |
linear-gradient(to right, hsla(0, 0%, 50%, 0.5) 1px, transparent 1px), | |
linear-gradient(to bottom, hsla(0, 0%, 50%, 0.5) 1px, transparent 1px) | |
', |
eleventyConfig.addFilter("smartquotes", (post) => { | |
const hawaii = new RegExp(/Hawai'i/g); | |
const slang = new RegExp(/'(cause|em|til|twas)/g); | |
const apostrophes = new RegExp(/(\b)'(\b)/g); | |
const years = new RegExp(/(\s)'(\d)/g); | |
const openDoubles = new RegExp(/(\s|^|>)"/g); | |
const closeDoubles = new RegExp(/"/g); | |
const openSingles = new RegExp(/(\s|^|>)'/g); | |
const closeSingles = new RegExp(/'/g); | |
return post |
// in .eleventy.js, add the two functions inside your `module.exports = function (eleventyConfig) {}` block: | |
``` | |
eleventyConfig.addFilter("toISOString", (date) => ( | |
new Date(`${date} 00:00:00`).toISOString() | |
)); | |
eleventyConfig.addFilter("formatDateForBlog", (date) => ( | |
new Date(`${date} 00:00:00`).toLocaleString('en-us', { month: 'long', day: 'numeric', year: 'numeric' }) | |
)); | |
``` |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(window).load(function(){ | |
$().hatchShow(); | |
}); | |
jQuery.fn.hatchShow = function(){ | |
$('.hsjs').css('display','inner-block').css('white-space','pre').each(function(){ | |
var t = $(this); | |
t.wrap("<span class='hatchshow_temp' style='display:block'>"); | |
var pw = t.parent().width(); |
// This is seven lines of vanilla JS that does most of what larger packages (like https://github.com/jackmoore/autosize) do. | |
// Might not work for your purposes, but it did for mine, and I figured I'd share. | |
const autogrow = (event) => { | |
const { target: textarea } = event; | |
const { textLength, style: { lineHeight, paddingTop, paddingBottom } } = textarea; | |
const widthInCharacters = parseInt(textarea.style.width, 10); | |
const adjustmentFactor = 0.8; // tune this up or down if the height is too aggressive (or not aggressive enough) | |
const lines = Math.floor(textLength * adjustmentFactor / widthInCharacters) + 1; | |
const height = `calc(${lines * lineHeight}em + ${paddingTop} + ${paddingBottom})`; |
<?PHP | |
shell_exec("touch messages1.txt"); | |
shell_exec("touch messages2.txt"); | |
$time_1 = microtime(true); | |
for ($i=1; $i<1000; $i++) { | |
file_put_contents('messages1.txt', "This is the sample text\n", FILE_APPEND); | |
} | |
$time_delta_1 = microtime(true) - $time_1; |