Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Daniel Leidert dleidert

🏠
Working from home
View GitHub Profile
View Get the download link for an asset of the latest release using site.github namespace in a Jekyll site hosted on GitHub page.md
@dleidert
dleidert / template.md
Last active Feb 26, 2019
Automatically create changelog / news page for last 5 releases using Jekyll and GitHub Pages
View template.md
{%- assign releases = site.github.releases | where: "draft", false | sort: "tag_name" | reverse -%}

## [UNRELEASED]({{ site.github.repository_url }}/tree/master/)

[compare changes to last release]({{ site.github.repository_url }}/compare/{{ releases[0].tag_name }}...master#files_bucket "Compare changes in master for upcoming release")

{% for release in releases limit:5 %}

## [{{ release.name }}]({{ release.html_url }}) {% if release.prerelease -%}(pre-release){%- endif %}
@dleidert
dleidert / Print site.github metadata.md
Last active Mar 1, 2019
Debug site.github metadata
View Print site.github metadata.md
---
layout: default
title: Debug site.github
---

```JSON
{{ site.github | neat_json }}
```
@dleidert
dleidert / Set notepad++ as default edit program for .html files.md
Last active Feb 25, 2019
Set notepad++ as default edit program for .html files
View Set notepad++ as default edit program for .html files.md
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.html\shell\edit\command /f /ve /t REG_EXPAND_SZ /d "\"^%ProgramFiles^%\Notepad++\notepad++.exe\" %1"

This will create a new key and add an Edit option to the file context menu!

@dleidert
dleidert / Set notepad++ as default edit program for text files.md
Created Feb 25, 2019
Set notepad++ as default edit program for text files
View Set notepad++ as default edit program for text files.md
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\text\shell\edit\command /f /ve /t REG_EXPAND_SZ /d "\"^%ProgramFiles^%\Notepad++\notepad++.exe\" %1"
@dleidert
dleidert / Set notepad++ as default edit program for text files.md
Created Feb 25, 2019
Set notepad++ as default edit program for text files
View Set notepad++ as default edit program for text files.md
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\text\shell\edit\command /f /ve /t REG_EXPAND_SZ /d "\"^%ProgramFiles^%\Notepad++\notepad++.exe\" %1"

This will overwrite the default value!

@dleidert
dleidert / skip_commits.md
Created Feb 26, 2019
Skip AppVeyour build jobs for commits regarding the docs folder and subfolders
View skip_commits.md

This will prevent AppVeyor from running a job, when commits are done regarding the docs directory only. It might be useful, when the projects repository contains the GitHub pages in the master branch and changes to them are not critical to the build.

skip_commits:
  files:
    - docs/**/*

I further exclude some other files too. This is my minimal list

@dleidert
dleidert / gitattributes.md
Created Feb 26, 2019
Exclude source files (e.g. GitHub pages) from the automatic github Zipball / Tarball creation
View gitattributes.md

I usually host a projects GitHub pages (docs/) and build service configration files (e.g. .travis.yml or .appveyor.yml) together with the projects source in the master branch. When creating a release, github creates a zip and a tar archive (the so called zipball and tarball), which can also be created these links:

https://api.github.com/repos/:user/:project/tarball
https://api.github.com/repos/:user/:project/zipball

or for a specific release:

@dleidert
dleidert / prepare-commit-hook.md
Last active Mar 1, 2019
Skip TRAVIS-CI builds for non-build relevant file changes
View prepare-commit-hook.md

TRAVIS builds are triggered by every commit to the repository. When hosting github pages with the source (e.g. in the docs folder), changes to the documentation are (usually) not critical to the build itself, so they could be easily skipped. Unfortunately TRAVIS does not offer a file-/foldername-based skip instruction like e.g. AppVeyor's skip_commits field.

But there seem to be two ways of achieving (almost) the same effect. In the following examples changes to the files

.appveyor.yml
.gitattributes
.gitignore
docs/**
@dleidert
dleidert / JSON-LD SoftwareApplication.md
Last active Mar 1, 2019
Provide structured (website) data for a software application using JSON-LD and GitHub pages / Jekyll
View JSON-LD SoftwareApplication.md

Below is an example for a jekyll template to provide structed data in JSON-LD for a software application using the site.github namespace (provided by the github-metadata) plugin). Assuming there is at least one release, this snippet is a starting point. Content represented by three dots ... usually needs to be added manually to the snippet:

{%- assign release = site.github.latest_release -%}
{
  "@context": "http://schema.org/",
  "@type": "SoftwareApplication",
  "codeRepository": "{{ repository_url }}",
  "programmingLanguage": {
    "@type": "ComputerLanguage",