Skip to content

Instantly share code, notes, and snippets.

View iaminamcom's full-sized avatar
🏠
Working from home

M. Inam iaminamcom

🏠
Working from home
View GitHub Profile
@inwardmovement
inwardmovement / layouts\partials\styles.html
Created January 27, 2020 09:12
Inline styles with Hugo
{{ with .Site.IsServer }}
<!-- Do not inline styles -->
<link rel="stylesheet" href="{{ $mainCSS.RelPermalink }}">
{{ end }}
<style>
{{ with or (getenv "PREVIEW") (getenv "PRODUCTION") }}
<!-- Inline styles -->
{{ $mainCSS.Content | safeCSS }}
{{ end }}
@Lego2012
Lego2012 / Hugo: Partial for creating breadcrumbs.md
Created January 29, 2019 08:40
Hugo: Partial for creating breadcrumbs
{{ define "breadcrumb" }}
  {{ with .Parent }}
    {{ template "breadcrumb" . }}
    <a href="{{ .URL }}">{{ if .IsHome }}Home{{ else }}{{.Title}}{{ end }}</a> >
  {{ end }}
{{ end }}

{{ if not .IsHome }}
 
@paulirish
paulirish / thing.js
Created May 7, 2018 17:18
log the clipboard contents
document.body.innerHTML = 'Paste or drop items onto this page. View results in console.';
function getPayload(item) {
const kind = item.kind;
switch (kind) {
case 'string': return new Promise(res => item.getAsString(res));
case 'file': return Promise.resolve(item.getAsFile());
default: throw new Error('unknown item kind! ' + kind);
}