Fix code fences

This commit is contained in:
David Eisinger
2025-02-16 15:00:39 -05:00
parent 31087c4349
commit 8e5e3781af
9 changed files with 18 additions and 18 deletions

View File

@@ -105,7 +105,7 @@ change this value, add the following to the "Custom Chef JSON" field:
}
}
}
````
```
(Substituting in your own application and environment names.)

View File

@@ -28,7 +28,7 @@ mysqldump -u [user] -p[pass] --skip-extended-insert [database] > [database].sql
git init
git add [database].sql
git commit -m "Initial commit"
````
```
The `--skip-extended-insert` option tells mysqldump to give each table
row its own `insert` statement. This creates a larger initial commit

View File

@@ -46,13 +46,13 @@ In a (Debian-based) Dockerfile:
RUN apt-get update &&
apt-get install -y libgirepository1.0-dev libpoppler-glib-dev &&
rm -rf /var/lib/apt/lists/*
````
```
Then, in your `Gemfile`:
```ruby
gem "poppler"
````
```
## Use it in your application

View File

@@ -25,7 +25,7 @@ just use the built-in Rails methods, i.e.
```ruby
render turbo_stream: turbo_stream.update("flash", partial: "shared/flash")
````
```
And though [DHH would
disagree](https://github.com/hotwired/turbo-rails/issues/77#issuecomment-757349251),

View File

@@ -81,7 +81,7 @@ So imagine an article like this:
```html
<h1>Headline</h1> <p>A paragraph.</p> <ul><li>List item #1</li> <li>List item #2</li></ul>
````
```
Our initial approach (with `strip_tags`) gives us this:

View File

@@ -88,7 +88,7 @@ update our naïve approach to look like this:
```ruby
dates = TimeEntry.all.map { |entry| entry.logged_on }.uniq
````
```
When we profile this code, we see that it performs slightly worse than
the non-unique version:

View File

@@ -14,7 +14,7 @@ in Rails:
=> #<Goal id: 1, description: "Run a mile", created_at: "2008-09-09 19:32:57", updated_at: "2008-09-09 19:32:57">
>> Goal.find(:all, :conditions => ['created_at < ?', Time.now])
=> []
````
```
Huh? Checking the logs, we see that the two commands above correspond to
the following queries:
@@ -22,7 +22,7 @@ the following queries:
```sql
INSERT INTO "goals" ("updated_at", "description", "created_at") VALUES('2008-09-09 19:32:57', 'Run a mile', '2008-09-09 19:32:57')
SELECT * FROM "goals" WHERE created_at < '2008-09-09 15:33:17'
````
```
Rails stores `created_at` relative to [Coordinated Universal
Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time), while

View File

@@ -35,7 +35,7 @@ want something you can drop into a GitHub Actions YAML file to lint your
commits, here it is (but stick around and I'll break it down and then
show how to do it in a few other languages):
``` yaml
```yaml
steps:
- name: Checkout code
uses: actions/checkout@v3
@@ -79,7 +79,7 @@ If you want to try this out locally (or perhaps modify the script to
validate messages in a different way), here's a `docker run` command
you can use:
``` bash
```bash
echo '[#123] Message 1
[n/a] Message 2
[#122] Message 3' | docker run --rm -i ruby:3.2.1 ruby -e '
@@ -104,7 +104,7 @@ several of Viget's other favorites:
### JavaScript
``` bash
```bash
git log --format=format:%s HEAD ^origin/main | node -e "
let msgs = require('fs').readFileSync(0).toString().trim().split('\n');
for (let msg of msgs) {
@@ -117,7 +117,7 @@ git log --format=format:%s HEAD ^origin/main | node -e "
To test:
``` bash
```bash
echo '[#123] Message 1
[n/a] Message 2
[#122] Message 3' | docker run --rm -i node:18.15.0 node -e "
@@ -132,7 +132,7 @@ echo '[#123] Message 1
### PHP
``` bash
```bash
git log --format=format:%s HEAD ^origin/main | php -r '
while ($msg = fgets(STDIN)) {
if (preg_match("/^\[(#\d+|n\/a)\]/", $msg)) { continue; }
@@ -144,7 +144,7 @@ git log --format=format:%s HEAD ^origin/main | php -r '
To test:
``` bash
```bash
echo '[#123] Message 1
[n/a] Message 2
[#122] Message 3' | docker run --rm -i php:8.2.4 php -r '
@@ -158,7 +158,7 @@ echo '[#123] Message 1
### Python
``` bash
```bash
git log --format=format:%s HEAD ^origin/main | python -c '
import sys
import re
@@ -172,7 +172,7 @@ for msg in sys.stdin:
To test:
``` bash
```bash
echo '[#123] Message 1
[n/a] Message 2
[#122] Message 3' | docker run --rm -i python:3.11.3 python -c '

View File

@@ -43,7 +43,7 @@ encrypt the certificate, I'd run:
```
> encrypt.sh production.pem \
"I can get you a toe by 3 o'clock this afternoon."
````
```
The script creates an encrypted file, `production.pem.enc`, and outputs
instructions for decrypting it, but with the password blanked out.