profile
viewpoint
Klaas Pieter Annema klaaspieter Sketch ¯\_(ツ)_/¯ https://annema.me Father. Husband. Baby wearer. Runner. Software developer at @sketch-hq. Ex @seedco @thoughtbot, @yourkarma, @madebysofa.

klaaspieter/APIClient 179

Convention over configuration REST API client for Objective-C

klaaspieter/chxcode 50

Changes the current Xcode

klaaspieter/coc-sourcekit 39

Swift language server extension using sourcekit-lsp for coc.nvim.

klaaspieter/cappuccino-comparisons 9

A collection of Cappuccion vs Cocoa comparison applications

klaaspieter/autonib2cib 6

Automatically nib2cib changed nibs in a directory

aljungberg/bottest 1

Testing some issue stuff.

klaaspieter/annemame 1

My personal website

klaaspieter/aristo 1

Aristo Artwork Files

klaaspieter/Cactus 1

Simple static site generator using Django templates.

klaaspieter/cappuccino 1

Web Application Framework in JavaScript and Objective-J

push eventcalleerlandsson/Tofu

Calle Luks

commit sha 68b0530729c8a1f9199355dc18ec21c983b3dddc

Remove unused icons

view details

push time in 5 hours

pull request commentcalleerlandsson/Tofu

Add Mastodon icon

Hey @FIGBERT, would you mind adding this as a PNG to IssuerIcons/ instead without rounded corners. Also, feel free to add a larger size (I've been using 1024x1024) as this gives us some flexibility if we end up wanting to show icons in a larger size. Thanks!

FIGBERT

comment created time in 5 hours

push eventcalleerlandsson/Tofu

Calle Luks

commit sha 3a159f77de229c7ef589c42bfb40576989317be1

Add source files for, and update, a bunch of icons

view details

push time in 5 hours

PR closed calleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

After our discussion on #52, I spent some time implementing the automated icon generation we discussed. The bash script uses sips – which ships with macOS – and ag – an ack alternative that you can install with Homebrew – to generate the icon files.

The one missing feature that we discussed is removing the hard-coded rounded corners, but that can be implemented in another pull request.

+90 -33

4 comments

308 changed files

FIGBERT

pr closed time in 11 hours

pull request commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

Merged as d6b4544f7a996fd2c7a4feaa77cdee7735240749 and 174fcf569a874472365a47e24b050eec0e4a86e9 with some small modifications:

  • I removed the comment about the regex since it was describing the old one.
  • I removed some empty lines
  • I brought back the unoptimized versions of all icons and re-ran the script. Xcode automatically runs all pngs through pngcrush as part of the build. Not optimizing the icons output by the script avoids having to re-optimize them everytime the script is run to avoid binary diffs.

Thanks so much @FIGBERT and @ThinkChaos!

FIGBERT

comment created time in 11 hours

push eventcalleerlandsson/Tofu

FIGBERT

commit sha d6b4544f7a996fd2c7a4feaa77cdee7735240749

Add .DS_Store to .gitignore

view details

FIGBERT

commit sha 174fcf569a874472365a47e24b050eec0e4a86e9

Replace IssuerIcons.sketch with pngs and a script GenerateIssuerIconAssets.sh will generate icons of the right sizes and as well as theri xcassets imagesets.

view details

push time in 11 hours

fork orta/markdown-translator

Directly translate markdown file using Azure Text Translate Api

fork in 2 days

fork orta/vscode-browser-preview

A real browser preview inside your editor that you can debug.

fork in 5 days

pull request commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

Alright, all suggestions implemented. Thanks to @ThinkChaos for the RegEx and directory pointers. Probably should squash before merging.

FIGBERT

comment created time in 6 days

issue commentcalleerlandsson/Tofu

Add option to change color of "icons"

That would definitely be better, I was just wondering if it would be easy to implement and it would match how you're able to change the background color for contacts in iOS

image

tycm

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'

I'd recommend dropping ag for something which comes preinstalled. Here's an example with sed:

$ echo ./IssuerIcons/a-name.png | sed -E 's:\./IssuerIcons/(.+)\.png:\1:'
a-name

I'd even go as far as removing the directory name from the regex like so: sed -E 's:.+/(.+)\.png:\1:'

FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{

Using a heredoc would make this cleaner:

cat << EOF
{
  "example": "$1"
}
EOF

You won't have to escape the quotes, and you still get variable expansion!

To redirect the output:

cat << EOF > output
...
EOF
FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do+  name="$(get_name $file)"+  echo "Generating icon for ${name}"+  imageset="./Tofu/Assets.xcassets/${name}.imageset/"+  mkdir -p "$imageset"+  sips --resampleWidth 192 "$file" --out "${imageset}${name}@3x.png" &>/dev/null

Is there a reason to also redirect STDERR? (&> vs >) I feel like this could lead to hard debugging later on.

FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do

Maybe adding cd "$(dirname "$0")" at the top of the script to ensure the working directory is always as expected is easier.

FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do

Thanks! If it's a hassle, I'm not sure it's worth it!

FIGBERT

comment created time in 6 days

issue commentcalleerlandsson/Tofu

Add option to change color of "icons"

Hi @tycm, thanks for the suggestion! My goal is to one day support user provided issuer icons. Maybe that can serve the same purpose as custom colored letters and backgrounds?

tycm

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do

In its current form the relative paths rely on the current working directory. I've implemented the other suggested changes, I'll take a look into this tomorrow – have to figure out how to make it work with the RegEx.

FIGBERT

comment created time in 6 days

issue commentcalleerlandsson/Tofu

TOTP with 12 digits causes crash

Sorry about that @eender. I'll look at it whenever I get a chance.

eender

comment created time in 6 days

delete branch calleerlandsson/Tofu

delete branch : improved-icons

delete time in 6 days

create barnchcalleerlandsson/Tofu

branch : improved-icons

created branch time in 6 days

pull request commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

I have a branch locally with quite a few icons without rounded corners and code to round them at runtime. Will post a PR with it as soon as I've had time to clean it up somewhat!

FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do

Do these relative paths rely on the current working directory from which the script is run? Do you think it would be possible to make them relative to the location of the script instead? Maybe using BASH_SOURCE?

FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do+  name="$(get_name $file)"+  echo "Generating icon for ${name}"+  imageset="./Tofu/Assets.xcassets/${name}.imageset/"+  (mkdir "$imageset" || true) 2>/dev/null

Could this use mkdir -p?

  mkdir -p "$imageset"
FIGBERT

comment created time in 6 days

Pull request review commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

+#!/usr/bin/env bash+set -euo pipefail++command -v ag >/dev/null 2>&1 || { echo >&2 "I require The Silver Searcher (ag) but it's not installed. Aborting."; exit 1; }+command -v sips >/dev/null 2>&1 || { echo >&2 "I require sips but it's not installed. Aborting."; exit 1; }++get_name() {+  # RegEx Explanation:+  #   Positive Lookbehind -- (?<=\.\/IssuerIcons\/)+  #     Asserts that the selected portion must be preceeded by ./IssuerIcons/+  #   Pattern Match -- .*+  #     Matches all characters, excluding newlines, of any length+  #   Positive Lookforward -- (?=\.png)+  #     Asserts that the selected portion must be followed by .png+  echo $1 | ag --only-matching '(?<=\.\/IssuerIcons\/).*(?=\.png)'+}++write_json() {+  # JSON copied from Xcode output+  echo -n "{+  \"images\" : [+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}.png\",+      \"scale\" : \"1x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@2x.png\",+      \"scale\" : \"2x\"+    },+    {+      \"idiom\" : \"universal\",+      \"filename\" : \"${1}@3x.png\",+      \"scale\" : \"3x\"+    }+  ],+  \"info\" : {+    \"version\" : 1,+    \"author\" : \"xcode\"+  }+}" > "${2}"+}++for file in ./IssuerIcons/*.png; do+  name="$(get_name $file)"+  echo "Generating icon for ${name}"+  imageset="./Tofu/Assets.xcassets/${name}.imageset/"+  (mkdir "$imageset" || true) 2>/dev/null+  cp "$file" "${imageset}${name}@3x.png"

What do you think of using sips here as well, with a size of 192? That way, icons in IssueIcons could be any larger size.

FIGBERT

comment created time in 6 days

pull request commentcalleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

Wow, that's super cool! Thanks so much for working on this! I'll read through the script and post feedback inline.

FIGBERT

comment created time in 6 days

PR opened calleerlandsson/Tofu

Move Icon Creation to GenerateIssuerIconAssets.sh

After our discussion on #52, I spent some time implementing the automated icon generation we discussed. The bash script uses sips – which ships with macOS – and ag – an ack alternative that you can install with Homebrew – to generate the icon files.

The one missing feature that we discussed is removing the hard-coded rounded corners, but that can be implemented in another pull request.

+63 -6

0 comment

280 changed files

pr created time in 7 days

push eventsketch-hq/svgo-compressor

Ale M

commit sha 457d738893e1ab23f4b685ecf40ae2ce471d0e0d

Removed TODO comments

view details

push time in 7 days

startedklaaspieter/chxcode

started time in 8 days

issue openedcalleerlandsson/Tofu

Add option to change color of "icons"

It'd be nice to be able to change the color of the letter and background for items without an icon.

created time in 9 days

more