Skip to content

Instantly share code, notes, and snippets.

View DirtyF's full-sized avatar
😷
Home

Frank Taillandier DirtyF

😷
Home
View GitHub Profile
@chrisdmacrae
chrisdmacrae / README.md
Last active January 30, 2018 21:45
Algolia Search - Forestry.io

Simple Algolia w/ Hugo

The following allows you to easily generate an Algolia index with Hugo consisting of whatever front matter metadata you like.

Why this compared to other plugins?

There are plugins that generate indexes using NPM packages or other tools. The issue is that they don't have any context to your site configuration or Hugo's internals, so they may miss pages or index pages that should not be indexed.

Using Hugo means your index has the full context of your site available when being generated.

Generating Index

To generate the index you create the index's layout at layouts/_default/list.algolia.json.

@budparr
budparr / figure.html
Last active September 23, 2020 15:39
Hugo "figure" shortcode that works with https://github.com/aFarkas/lazysizes and uses `markdownify` for title and caption #gohugo
<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }} class="lazyload" />
<noscript>
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}/>
</noscript>
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
@hsablonniere
hsablonniere / README.adoc
Last active May 11, 2024 12:50
Conference bingo

Conference bingo

Background

In many tech conferences, attendees are invited to rate the talk and/or the speaker from 1 to 5 stars. This type of ratings is interesting but has a few drawbacks.

The discussion started as a twitter thread with this french proposition.

C9M xEZWsAARmav
@budparr
budparr / csplit.txt
Last active September 28, 2018 08:56
Terminal command to split a list of markdown items into separate documents. Given a "slug" value, the file will be named that. You could also change slug to title and create slugs/filenames from the title. You may also want to run your output through a markdown converter, like https://github.com/domchristie/to-markdown
csplit -k -n 3 export.txt '/^@@@/' {'999'}; for i in xx*; do sed -i '' 's/@@@/---/g' $i; done; for i in xx*; do mv $i `egrep -m1 -e 'slug:.*' $i | sed -e s/[^\]\[A-Za-z0-9~.,_{}\(\)\'\-\+]/-/g -e s/slug--//`.md; done
@budparr
budparr / robots.txt
Last active August 13, 2019 14:21
Jekyll Robots page to exclude from robots pages that are excluded from the sitemap
---
layout: null
permalink: robots.txt
---
# filter pages and documents for the noindex key
{% assign noindexPages = site.pages | where: 'sitemap', false %}
{% assign noindexDocuments = site.documents | where: 'sitemap', false %}
User-agent: *
# robotstxt.org - if _config production variable is false robots will be disallowed.
{% if site.production != true %}
@ttscoff
ttscoff / font_grabber.rb
Last active May 13, 2021 06:14
Give it a <link> from Google fonts and get back CSS with fonts embedded
#!/usr/bin/ruby
# encoding: utf-8
# Grab google web fonts and embed them as base64 data URIs
# <http://brettterpstra.com/2015/03/14/embedding-google-web-fonts/>
require 'base64'
if ARGV.length > 0
input = ARGV
elsif STDIN.stat.size > 0
input = STDIN.read.strip.split(/\n+/)
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@jacrook
jacrook / font_variables.scss
Last active July 2, 2023 16:47
Sass Css Font Stack Variables
//////////////////////////////////////////////////////////////
// Font Variables (http://cssfontstack.com/)
//////////////////////////////////////////////////////////////
//
// Serif font-stacks
//
$baskerville-font-stack: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif !default;
@SirRawlins
SirRawlins / Rakefile
Last active September 15, 2020 06:22
Using Jekyll plugins on GitHub Pages.
# Rquire jekyll to compile the site.
require "jekyll"
# Github pages publishing.
namespace :blog do
#
# Because we are using 3rd party plugins for jekyll to manage the asset pipeline
# and suchlike we are unable to just branch the code, we have to process the site
# localy before pushing it to the branch to publish.
#