This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fluid typography between a min & max font-size and molten leading | |
* calc(minSize + (maxSize - minSize) * ((100vw - minPort) / (maxPort - minPort))); | |
*/ | |
:root { | |
font-size: 100%; | |
} | |
body { | |
font-size: 1em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "<project>", | |
"private": true, | |
"scripts": { | |
"css": "postcss --use postcss-import --use postcss-modular-scale-plus --use postcss-custom-properties --use postcss-custom-media --use css-mqpacker --css-mqpacker.sort --use postcss-calc --use autoprefixer --autoprefixer.browsers 'last 2 versions' --use cssnano --cssnano.safe", | |
"build:css": "npm run css -- --output assets/css/full.min.css assets/css/src/index.css", | |
"watch:css": "npm run css -- --watch --output assets/css/full.min.css assets/css/src/index.css", | |
"js": "uglifyjs --no-mangle --quotes=1", | |
"build:js": "npm run js -- --compress drop_console=true --output assets/js/full.min.js assets/js/src/lib/*.js assets/js/src/*.js", | |
"watch:js": "watch 'npm run js -- --compress --output assets/js/full.min.js assets/js/src/lib/*.js assets/js/src/*.js' assets/js/src", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* See https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#spaceless | |
* Removes whitespace between HTML tags. This includes tab characters and newlines. | |
* Only space between tags is removed – not space between tags and text. | |
* Single spaces between tags are preserved as they are probably intentional. | |
*/ | |
function spaceless($string) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = document.getElementById('mylist'); | |
var items = list.childNodes; | |
var itemsArr = []; | |
for (var i in items) { | |
if (items[i].nodeType == 1) { // get rid of the whitespace text nodes | |
itemsArr.push(items[i]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function filter($response, $arguments) | |
{ | |
$data = json_decode($response); | |
$dom = new \DOMDocument; | |
$dom->loadHTML($data->html); | |
$iframe = $dom->getElementsByTagName('iframe')->item(0); | |
if ($iframe === null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 16:9 example */ | |
div { | |
width: 100vw; | |
height: 56.25vw; /* 100/56.25 = 1.778 */ | |
background: pink; | |
max-height: 100vh; | |
max-width: 177.78vh; /* 16/9 = 1.778 */ | |
margin: auto; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
rect, line { shape-rendering: crispEdges; } | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Uses Alan Moore's regexp: | |
* http://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter | |
* | |
* Replace `echo $kirby->launch();` in Kirby’s index.php by | |
* the following code to minify the HTML output | |
* (it leaves whitespace within `<pre>` and `<textarea>` tags untouched) | |
*/ | |
echo preg_replace( | |
'/(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!\/?(?:textarea|pre)\b))*+) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple PHP if statement to execute recurring tasks | |
* by executing those when visited by a bot | |
*/ | |
if (preg_match('/slurp|googlebot/i', $_SERVER['HTTP_USER_AGENT'])) { | |
// tasks to execute | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using a for loop on an object | |
for (key in object) { | |
if (object.hasOwnProperty(key)) { | |
object[key]; | |
} | |
} |