Skip to content

Instantly share code, notes, and snippets.

@caraya
caraya / Convert MARKDOWN files to HTML
Created Apr 30, 2021 — forked from jose8a/Convert MARKDOWN files to HTML
Converting a folder full of markdown files, each linking to each other ... convert those files to HTML, and convert the relative links to point to the new html files. Add code highlighting with highlight.js . Finally serve up the result as a static web site.
View Convert MARKDOWN files to HTML
Converting md files to html w/highlighting
0a) Create a root directory to pull in all the repos
0b) Recursively clone or pull each repo
$> git clone <repo_url> | git pull on the existing repos
0c) Create a TOC index.html file for the root folder
$> echo '<head>' >> index.html
$> echo '' >> index.html
$> echo '</head>' >> index.html
$> echo '<body>' >> index.html
$> ls >> temp.html
View markdown-problem-file.md
@caraya
caraya / webstoemp-gulpfile.js
Created Jan 24, 2020 — forked from jeromecoupe/webstoemp-gulpfile.js
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
View webstoemp-gulpfile.js
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
View query.sql
-- Trying to figure out if this query is correct
-- and whether there are wasy to optimize it soo it
-- won't take as long as it does to run and produce results
SELECT
_TABLE_SUFFIX AS yyyymm,
SUM(fcp.density) AS average_fcp,
SUM(fp.density) as average_fp,
SUM(dcl.density) as average_dcl
FROM
`chrome-ux-report.country_cl.*`,
@caraya
caraya / scripts-to-footer-exclude-amp.php
Created Dec 4, 2019 — forked from westonruter/scripts-to-footer-exclude-amp.php
Exclude all AMP scripts from being moved to the footer by the Scripts To Footer plugin. All AMP scripts have async anyway so they do not need to be moved to the footer for performance.
View scripts-to-footer-exclude-amp.php
View gulpfile.js
/* eslint-disable require-jsdoc */
/* eslint-disable valid-jsdoc */
'use strict';
// Require Gulp first
const gulp = require('gulp');
// packageJson = require('./package.json'),
// Load plugins
const $ = require('gulp-load-plugins')({
lazy: true,
@caraya
caraya / displacement.html
Created Mar 25, 2019 — forked from akella/displacement.html
svg displacement animation
View displacement.html
<filter id="displacement" filterUnits="objectBoundingBox">
<feTurbulence type="turbulence" baseFrequency="0.01" numOctaves="2" result="turb"/>
<feColorMatrix in="turb" result="huedturb" type="hueRotate" values="90">
<animate attributeType="XML" attributeName="values" values="0;180;360" dur="6s" repeatCount="indefinite"/>
</feColorMatrix>
<feDisplacementMap in="SourceGraphic" in2="huedturb" scale="20" result="displace" xChannelSelector="B"/>
<feOffset dx="-5" dy="-5" in="displace" result="unoffsetdisplace"/>
</filter>
View article-template.css
/* Monospaced font for code samples */
@font-face {
font-family: "notomono_regular";
src: url("../fonts/notomono-regular.eot");
src: url("../fonts/notomono-regular.eot?#iefix") format("embedded-opentype"), url("../fonts/notomono-regular.woff2") format("woff2"), url("../fonts/notomono-regular.woff") format("woff"), url("../fonts/notomono-regular.ttf") format("truetype"), url("../fonts/notomono-regular.svg#notomono_regular") format("svg");
font-weight: normal;
font-style: normal;
}
/* Regular font */
@font-face {
View article-template.css
/* Monospaced font for code samples */
@font-face {
font-family: "notomono_regular";
src: url("../fonts/notomono-regular.eot");
src: url("../fonts/notomono-regular.eot?#iefix") format("embedded-opentype"), url("../fonts/notomono-regular.woff2") format("woff2"), url("../fonts/notomono-regular.woff") format("woff"), url("../fonts/notomono-regular.ttf") format("truetype"), url("../fonts/notomono-regular.svg#notomono_regular") format("svg");
font-weight: normal;
font-style: normal;
}
/* Regular font */
@font-face {
@caraya
caraya / lazy-video-loader.js
Created Mar 5, 2019 — forked from benrobertsonio/lazy-video-loader.js
Lazy Loading Video Based on Connection Speed
View lazy-video-loader.js
class LazyVideoLoader {
constructor() {
this.videos = [].slice.call(document.querySelectorAll('.hero__bgvideo'));
// Abort when:
// - The browser does not support Promises.
// - There no videos.
// - If the user prefers reduced motion.
// - Device is mobile.
if (