wrote my first post 🎉
parent
43842b9822
commit
25b71d5fd6
|
|
@ -3,12 +3,102 @@ title: "{{ replace .Name "-" " " | title }}"
|
|||
date: {{ .Date }}
|
||||
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
|
||||
{{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
|
||||
|
||||
```go
|
||||
{{<highlight go "linenos=table,hl_lines=8 15-17,linenostart=199">}}
|
||||
// GetTitleFunc returns a func that can be used to transform a string to
|
||||
// title case.
|
||||
//
|
||||
|
|
@ -31,5 +121,5 @@ func GetTitleFunc(style string) func(s string) string {
|
|||
return tc.Title
|
||||
}
|
||||
}
|
||||
{{< / highlight >}}
|
||||
|
||||
{{</highlight>}}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,23 +1,26 @@
|
|||
@import 'nav';
|
||||
@import 'list';
|
||||
@import "nav";
|
||||
@import "list";
|
||||
|
||||
html, body {
|
||||
font-family: Verdana, Sans-Serif;
|
||||
html,
|
||||
body {
|
||||
font-family: Verdana, Sans-Serif;
|
||||
font-size: 12pt;
|
||||
line-height: 1.7;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
.container {
|
||||
// display: flex;
|
||||
// flex-direction: row-reverse;
|
||||
max-width: 960px;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr;
|
||||
grid-template-columns: 4fr 1fr;
|
||||
}
|
||||
|
||||
#header {
|
||||
|
|
@ -41,5 +44,3 @@ h1, h2, h3 {
|
|||
grid-column-end: 3;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,27 @@
|
|||
.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 {
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
||||
font-size: 16pt;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ baseURL = "https://vdhsn.com"
|
|||
languageCode = "en-us"
|
||||
title = "Adam's Blog"
|
||||
theme = "solar-theme-hugo"
|
||||
pygmentsStyle = "solarized-dark" # solarized-light, -dark or -dark256
|
||||
pygmentsStyle = "solarized-dark256" # solarized-light, -dark or -dark256
|
||||
summaryLength = 32
|
||||
|
||||
|
||||
[params]
|
||||
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"
|
||||
16
hugo
16
hugo
|
|
@ -1,7 +1,11 @@
|
|||
#!/bin/bash
|
||||
exec docker run -it --rm --name hugo \
|
||||
-p 1313:1313 \
|
||||
-v $PWD:/opt/workdir:Z \
|
||||
--privileged \
|
||||
-u ${UID}:${UID} \
|
||||
--entrypoint=/usr/local/bin/hugo hugo $@
|
||||
if [ -z "$(docker ps | grep hugo)" ]; then
|
||||
exec docker run -it --rm --name hugo \
|
||||
-p 1313:1313 \
|
||||
-v $PWD:/opt/workdir:Z \
|
||||
--privileged \
|
||||
-u ${UID}:${UID} \
|
||||
--entrypoint=/usr/local/bin/hugo hugo $@
|
||||
else
|
||||
exec docker exec -it hugo hugo $@
|
||||
fi
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<body>
|
||||
<div class="container">
|
||||
<header id="header">
|
||||
<h1><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
|
||||
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
|
||||
</header>
|
||||
|
||||
<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">
|
||||
<p class="copyright">
|
||||
© {{ now.Format "2006"}} Adam Veldhousen.
|
||||
<a
|
||||
href="https://creativecommons.org/licenses/by/3.0/"
|
||||
title="Creative Commons Attribution"
|
||||
>Some rights reserved</a
|
||||
>. Powered by <a href="https://vdhsn.com">hugo</a>.
|
||||
© 2019 - {{ now.Format "2006"}} Adam Veldhousen.
|
||||
<a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons Attribution">
|
||||
Some rights reserved
|
||||
</a>. Powered by <a href="https://vdhsn.com">Hugo</a>.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
|
@ -15,10 +13,7 @@
|
|||
|
||||
(function() {
|
||||
var ga = document.createElement("script");
|
||||
ga.src =
|
||||
("https:" == document.location.protocol
|
||||
? "https://ssl"
|
||||
: "http://www") + ".google-analytics.com/ga.js";
|
||||
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
|
||||
ga.setAttribute("async", "true");
|
||||
document.documentElement.firstChild.appendChild(ga);
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in New Issue