Skip to content

Instantly share code, notes, and snippets.

{{ define "main" }}
<div class="content list h-feed singlearea">
{{$pages := where .Site.Pages "Type" "post" }}
{{ range $pages.GroupByDate "2006" }}
<div class="year">
<h2>{{ .Key }}</h2>
{{ range .Pages.GroupByDate "January" }}
<div class="month">
<h3>{{ .Key }}</h3>
<div class="post-list">
@jsonbecker
jsonbecker / praticktheme.html
Created December 23, 2024 18:50
praticktheme.html
<div class="day-homepage">
<!-- Loop over each post in the group -->
{{ range .Pages.Reverse }}
<!-- Display logic for each post -->
<a href="{{ .Permalink }}" class="post-date u-url">
<time class="dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> {{ .Date.Format "03:04 PM" }}</time> ∞
</a>
{{ if .Title }}
<h2 class="post-title p-name"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
{{ end }}
@jsonbecker
jsonbecker / example.html
Last active November 2, 2024 15:48
Showing how the user of flex and flex direction behaves different.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>jsonbecker</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
@jsonbecker
jsonbecker / index.html
Created August 8, 2023 00:08
One page at a time, chronological for Tufte
{{ partial "head.html" . }}
<body>
<div class="content list h-feed">
{{ partial "header.html" . }}
{{ $paginator := .Paginate (where .Site.Pages "Type" "post").ByDate.Reverse 1 }}
{{ range $paginator.Pages }}
{{ partial "li.html" . }}
{{ end }}
{{ partial "pagination.html" . }}
{{ partial "footer.html" . }}
@jsonbecker
jsonbecker / adn_download.exs
Created June 3, 2023 16:12
An inefficient way to download your App Dot Net posts using Elixir
Mix.install([{:httpoison, "~> 2.0"}])
defmodule ADNDownloader do
require HTTPoison
@base_url "https://adn.micro.blog/"
def get_posts(user_name) do
url = @base_url <> "users/" <> String.at(user_name, 0) <> "/" <> user_name <> ".txt"
@jsonbecker
jsonbecker / glightbox.html
Last active December 31, 2019 04:19
GLightbox shortcode
<a href="{{ .Get "src" }}"
class="glightbox"
{{ if .Get "gallery"}}
data-gallery="{{ .Get "gallery" }}"
{{ end }}
{{ if or (.Get "title") (.Get "description") }}
data-glightbox="title:{{ .Get "title" | default "" }};description:{{ .Get "description" | default "" }}"
{{end}}
>
<img src="{{ .Get "src" }}"
@jsonbecker
jsonbecker / geom_bar_fill.R
Created December 1, 2016 04:01
How do I get labels on this plot?
library(ggplot2)
df <- data.frame(type = c(rep('Elementary', 2), rep('Middle', 2), rep('High', 2)),
included = rep(c('included','excluded'),3),
dollars = c(1000, 2500, 4000, 1000, 3000, 2800))
ggplot(data = df, aes(type, dollars, fill = included)) +
geom_bar(position = 'fill', stat = 'identity') +
geom_text()

Keybase proof

I hereby claim:

  • I am jsonbecker on github.
  • I am jsonbecker (https://keybase.io/jsonbecker) on keybase.
  • I have a public key ASDIgFzpTFWImOtO0Dw5-XJVu-LiDxUfqB53ZkGSUzla7go

To claim this, I am signing this object:

@jsonbecker
jsonbecker / timing.R
Created September 19, 2016 20:00
A small bit of code to log how long something took
# Ever want to log how long someting takes? I know I do. timing()
# isn't about benchmarking, it's about getting feedback from long running
# tasks, especially if they are scheduled in production. Anyway, I love
# this function because it's a simple wrapper that can go around anything.
# I use it inside our tools at Allovue when extracting data to get things
# like this:
#> accounts <- extract_data(config_file$accounts)
# Starting queries/accounts.sql at: Mon Sep 19 15:27:34 2016
# Completed at: Mon Sep 19 15:28:14 2016
## Current pattern
function(myList){
do_stuff_with(mylist$attribute1, myList$attribute2)
do_stuff_with(mylist$attribute3, myList$attribute4)
}
## Desired pattern
function(myList){
do_stuff_with(attribute1, attribute2)
do_stuff_with(attribute4, attribute4)