Skip to content

Instantly share code, notes, and snippets.

View freshyill's full-sized avatar
💭
😎 Cool

Chris Coleman freshyill

💭
😎 Cool
View GitHub Profile
@freshyill
freshyill / .eleventy.js
Last active April 13, 2022 14:38
YouTube Editor component for Netlify CMS
module.exports = function(eleventyConfig) { // This only happens once in your template!
// Blah blah, whatever other Eleventy stuff you need.
eleventyConfig.addLiquidShortcode("youtube", (youtubeId, aspectRatio) => {
return `<div class="aspect-ratio" style="--aspect-ratio: ${aspectRatio}"><iframe class="youtube-player video video--youtube" src="https://www.youtube.com/embed/${youtubeId}/" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;
});
// Blah blah, whatever other Eleventy stuff you need.
@freshyill
freshyill / smoothScroll.js
Created January 16, 2018 05:47
Simple smooth scrolling for internal links
function smoothScroll() {
const internalLinks = document.querySelectorAll('a[href^="#"]');
internalLinks.forEach(
function(currentLink) {
const linkHref = currentLink.getAttribute('href');
currentLink.addEventListener("click", function(event) {
document.querySelector(linkHref).scrollIntoView({
@freshyill
freshyill / zip_folders.sh
Created June 26, 2017 18:01
Zip each folder in directory
for f in * [14:00:21]
do
zip -r "${f}.zip" "$f"
done
@freshyill
freshyill / count.sh
Last active April 25, 2018 15:40
Count lines in a directory of files
COUNTER=0;
for files in *;
do
if test -f "$files"; then
LINES=`wc -l $files | awk '{print $1}'`
fi
COUNTER=`expr $COUNTER + $LINES`;
done
@freshyill
freshyill / index.js
Last active June 18, 2017 19:54
Convert JATS XML to JSON with Camaro
const fs = require("fs");
const transform = require("camaro");
const dedent = require("deline");
const xmlDir = "test_xml";
fs.readdir(xmlDir, (err, files) => {
files.forEach(file => {
const xml = fs.readFileSync(xmlDir + "/" + file, "utf-8", (err, data) => {
if (err) throw err;

Keybase proof

I hereby claim:

  • I am freshyill on github.
  • I am freshyill (https://keybase.io/freshyill) on keybase.
  • I have a public key ASCQl-BDW0UfZrr4mEIklk7u774J8jmiNn0I1gY7WRYd-Ao

To claim this, I am signing this object:

@freshyill
freshyill / child.html
Created May 4, 2017 04:42
Pym.js test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Child</title>
<style media="screen">
#child {
color: fuchsia;
font-weight: bold;
const fs = require('fs');
const convert = require('xml2json');
const xmlDir = 'final_xml';
fs.readdir(xmlDir, (err, xmlList) => {
for (let xmlFile of xmlList) {
fs.readFile(xmlDir + "/" + xmlFile, "utf-8", (err, fileContents) => {
@freshyill
freshyill / Rebel_Alliance.svg
Last active May 1, 2017 03:05
Rebel Alliance
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@freshyill
freshyill / wp-config.php
Created November 27, 2015 06:09 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
// Explicitely setting url
define( 'WP_HOME', 'http://domain.com' );
define( 'WP_SITEURL', 'http://domain.com' );
// Set url to... whatever.
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );