wrote my first post 🎉
parent
43842b9822
commit
25b71d5fd6
|
|
@ -3,11 +3,101 @@ title: "{{ replace .Name "-" " " | title }}"
|
||||||
date: {{ .Date }}
|
date: {{ .Date }}
|
||||||
draft: true
|
draft: true
|
||||||
---
|
---
|
||||||
|
Headers
|
||||||
|
|
||||||
|
# Header 1
|
||||||
|
## Header 2
|
||||||
|
### Header 3
|
||||||
|
#### Header 4 ####
|
||||||
|
##### Header 5 #####
|
||||||
|
###### Header 6 ######
|
||||||
|
|
||||||
|
*Emphasize* _emphasize_
|
||||||
|
**Strong** __Strong__
|
||||||
|
A [link](http://example.com "Title").
|
||||||
|
Some text with [a link][1] and another [link][2].
|
||||||
|
|
||||||
|
[1]: http://example.com/ "Title"
|
||||||
|
[2]: http://example.org/ "Title"
|
||||||
|
|
||||||
|
Logo: 
|
||||||
|
Smaller logo: ![Alt][1]
|
||||||
|
[1]: /wp-smaller.png "Title"
|
||||||
|
|
||||||
|
Linked logo: [] (http://wordpress.com/ "Title")
|
||||||
|
|
||||||
|
Lists
|
||||||
|
|
||||||
|
1. Item
|
||||||
|
2. Item
|
||||||
|
* Mixed
|
||||||
|
* Mixed
|
||||||
|
- or dash
|
||||||
|
3. Item
|
||||||
|
|
||||||
|
Blockquotes
|
||||||
|
|
||||||
|
> Quoted text.
|
||||||
|
> > Quoted quote.
|
||||||
|
|
||||||
|
> * Quoted
|
||||||
|
> * List
|
||||||
|
|
||||||
|
|
||||||
|
Quoted text.
|
||||||
|
|
||||||
|
Quoted quote.
|
||||||
|
|
||||||
|
Quoted
|
||||||
|
List
|
||||||
|
|
||||||
|
Preformatted
|
||||||
|
|
||||||
|
Begin each line with
|
||||||
|
two spaces or more to
|
||||||
|
make text look
|
||||||
|
e x a c t l y
|
||||||
|
like you type i
|
||||||
|
t.
|
||||||
|
|
||||||
|
|
||||||
|
Begin each line with
|
||||||
|
two spaces or more to
|
||||||
|
make text look
|
||||||
|
e x a c t l y
|
||||||
|
like you type i
|
||||||
|
t.
|
||||||
|
|
||||||
|
Code
|
||||||
|
|
||||||
|
`This is code`
|
||||||
|
|
||||||
|
This is code
|
||||||
|
Code block
|
||||||
|
|
||||||
|
~~~~
|
||||||
|
This is a
|
||||||
|
piece of code
|
||||||
|
in a block
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
```
|
||||||
|
This too
|
||||||
|
```
|
||||||
|
|
||||||
|
Syntax highlighting
|
||||||
|
|
||||||
|
```css
|
||||||
|
#button {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Example code
|
Example code
|
||||||
|
|
||||||
|
```go
|
||||||
{{<highlight go "linenos=table,hl_lines=8 15-17,linenostart=199">}}
|
{{<highlight go "linenos=table,hl_lines=8 15-17,linenostart=199">}}
|
||||||
// GetTitleFunc returns a func that can be used to transform a string to
|
// GetTitleFunc returns a func that can be used to transform a string to
|
||||||
// title case.
|
// title case.
|
||||||
|
|
@ -32,4 +122,4 @@ func GetTitleFunc(style string) func(s string) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{</highlight>}}
|
{{</highlight>}}
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,26 @@
|
||||||
@import 'nav';
|
@import "nav";
|
||||||
@import 'list';
|
@import "list";
|
||||||
|
|
||||||
html, body {
|
html,
|
||||||
|
body {
|
||||||
font-family: Verdana, Sans-Serif;
|
font-family: Verdana, Sans-Serif;
|
||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3 {
|
h1,
|
||||||
|
h2,
|
||||||
|
h3 {
|
||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// flex-direction: row-reverse;
|
// flex-direction: row-reverse;
|
||||||
max-width: 960px;
|
max-width: 1280px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 2fr 1fr;
|
grid-template-columns: 4fr 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
|
|
@ -41,5 +44,3 @@ h1, h2, h3 {
|
||||||
grid-column-end: 3;
|
grid-column-end: 3;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,27 @@
|
||||||
.post {
|
.post {
|
||||||
|
#tags {
|
||||||
|
display: flex;
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin-right: 5px;
|
||||||
|
background-color: black;
|
||||||
|
padding: 0 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p code {
|
||||||
|
background-color: #1c1c1c;
|
||||||
|
color: #a31515;
|
||||||
|
}
|
||||||
|
|
||||||
.postdate {
|
.postdate {
|
||||||
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
|
font-size: 16pt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ baseURL = "https://vdhsn.com"
|
||||||
languageCode = "en-us"
|
languageCode = "en-us"
|
||||||
title = "Adam's Blog"
|
title = "Adam's Blog"
|
||||||
theme = "solar-theme-hugo"
|
theme = "solar-theme-hugo"
|
||||||
pygmentsStyle = "solarized-dark" # solarized-light, -dark or -dark256
|
pygmentsStyle = "solarized-dark256" # solarized-light, -dark or -dark256
|
||||||
|
summaryLength = 32
|
||||||
|
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
author = "Adam Veldhousen"
|
author = "Adam Veldhousen"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
---
|
||||||
|
title: "Git Tips - Global Pre-commit Hooks"
|
||||||
|
date: 2020-01-01T21:00:39Z
|
||||||
|
tags: [git, testing, bash]
|
||||||
|
---
|
||||||
|
|
||||||
|
[Git hooks][1] are a feature of the Git VCS that allow you to fire off custom logic on the client side when you take
|
||||||
|
actions in your repository. These are shell scripts in the `.git/hooks/` directory of your repository, but they can also
|
||||||
|
exist at `~/.githooks/`.
|
||||||
|
|
||||||
|
Any hooks found in `~/.githooks/` are executed globally for the user of that shell, this makes it awesome for running a
|
||||||
|
custom workflow that is consistent across your entire machine.
|
||||||
|
|
||||||
|
## Useful hooks
|
||||||
|
|
||||||
|
My favorite hook that I'm running these days is a `~/.githooks/pre-commit` hook that auto runs tests and lint commands
|
||||||
|
if they're found.
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
{{<highlight bash "linenos=table">}}
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -f "$PWD/makefile" ] && [ ! -z "$(cat $PWD/makefile | grep '^lint:')" ]; then
|
||||||
|
echo "running make lint"
|
||||||
|
make lint
|
||||||
|
elif [ -f "$PWD/package.json" ] && [ ! -z "$(cat $PWD/package.json | grep "^\"lint\":")" ]; then
|
||||||
|
echo "running npm run lint"
|
||||||
|
npm run lint
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$PWD/makefile" ] && [ ! -z "$(cat $PWD/makefile | grep '^test:')" ]; then
|
||||||
|
echo "running make test"
|
||||||
|
make test
|
||||||
|
elif [ -f "$PWD/package.json" ] && [ ! -z "$(cat $PWD/package.json | grep "^\"test\":")" ]; then
|
||||||
|
echo "running npm run test"
|
||||||
|
npm run test
|
||||||
|
fi
|
||||||
|
{{</highlight>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
If the test or lint command fails then the `git commit` command fails. If I absolutely need to commit something in spite
|
||||||
|
of the lint/test results failing I can do `git commit --no-verify` to skip the `pre-commit` hook.
|
||||||
|
|
||||||
|
[1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks "Git hooks"
|
||||||
4
hugo
4
hugo
|
|
@ -1,7 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
if [ -z "$(docker ps | grep hugo)" ]; then
|
||||||
exec docker run -it --rm --name hugo \
|
exec docker run -it --rm --name hugo \
|
||||||
-p 1313:1313 \
|
-p 1313:1313 \
|
||||||
-v $PWD:/opt/workdir:Z \
|
-v $PWD:/opt/workdir:Z \
|
||||||
--privileged \
|
--privileged \
|
||||||
-u ${UID}:${UID} \
|
-u ${UID}:${UID} \
|
||||||
--entrypoint=/usr/local/bin/hugo hugo $@
|
--entrypoint=/usr/local/bin/hugo hugo $@
|
||||||
|
else
|
||||||
|
exec docker exec -it hugo hugo $@
|
||||||
|
fi
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<header id="header">
|
<header id="header">
|
||||||
<h1><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
|
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{{ define "main" }}
|
||||||
|
<article class="post">
|
||||||
|
<h1 class="title"><a href="{{ .Permalink }}">{{ .Title }}</a> {{ if .Draft }}(Draft){{ end }}</h1>
|
||||||
|
<p class="meta">
|
||||||
|
<span class="postdate">Posted {{ .Date.Format "January 02 2006" }}</span><br/>
|
||||||
|
{{ $taxo := "tags" }} <!-- Use the plural form here -->
|
||||||
|
<ul id="{{ $taxo }}" >
|
||||||
|
{{ range .Param $taxo }}
|
||||||
|
{{ $name := . }}
|
||||||
|
{{ with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }}
|
||||||
|
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="post-content">{{ .Content | safeHTML }}</div>
|
||||||
|
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
<div id="partial-footer">
|
<div id="partial-footer">
|
||||||
<p class="copyright">
|
<p class="copyright">
|
||||||
© {{ now.Format "2006"}} Adam Veldhousen.
|
© 2019 - {{ now.Format "2006"}} Adam Veldhousen.
|
||||||
<a
|
<a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons Attribution">
|
||||||
href="https://creativecommons.org/licenses/by/3.0/"
|
Some rights reserved
|
||||||
title="Creative Commons Attribution"
|
</a>. Powered by <a href="https://vdhsn.com">Hugo</a>.
|
||||||
>Some rights reserved</a
|
|
||||||
>. Powered by <a href="https://vdhsn.com">hugo</a>.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
@ -15,10 +13,7 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var ga = document.createElement("script");
|
var ga = document.createElement("script");
|
||||||
ga.src =
|
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
|
||||||
("https:" == document.location.protocol
|
|
||||||
? "https://ssl"
|
|
||||||
: "http://www") + ".google-analytics.com/ga.js";
|
|
||||||
ga.setAttribute("async", "true");
|
ga.setAttribute("async", "true");
|
||||||
document.documentElement.firstChild.appendChild(ga);
|
document.documentElement.firstChild.appendChild(ga);
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue