Skip to content

Instantly share code, notes, and snippets.

View koddsson's full-sized avatar
:fishsticks:

Kristján Oddsson koddsson

:fishsticks:
View GitHub Profile
@koddsson
koddsson / Gemfile
Last active March 8, 2022 20:43
Convert LaTeX to MathML in Ruby
source 'https://rubygems.org'
gem 'itextomml'
@koddsson
koddsson / bib.bib
Created December 24, 2020 15:27
Create a HTML post from a obsidian markdown page
@book{ahrensHowTakeSmart2017,
title = {How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking: For Students, Academics and Nonfiction Book Writers},
shorttitle = {How to Take Smart Notes},
author = {Ahrens, S{\"o}nke},
year = {2017},
address = {{North Charleston, SC}},
isbn = {978-1-5428-6650-7},
language = {eng}
}
@koddsson
koddsson / index.js
Created December 19, 2019 12:44
A simple app that scrapes rightmove for flats and sends them to a Telegram chat.
#!/usr/bin/env node
const cheerio = require('cheerio')
const fetch = require('node-fetch')
const loki = require('lokijs')
const telegram = require('telegram-bot-api')
const api = new telegram({ token: process.env.TELEGRAM_API });
const db = new loki('rightmoveFile', {
autoload: true,
@koddsson
koddsson / n
Created June 26, 2019 21:52
Simple Bash script that let's me post a micropub note from my terminal
#! /bin/bash
ME="https://koddsson.com"
MICROPUB_ENDPOINT="$ME/micropub"
CODE=$(cat token)
STATUS_CODE=$(curl -sw '%{http_code}' -o /dev/null -d "code=$CODE&redirect_uri=http://nonexisting-domain.dev/callback&client_id=$ME" https://indieauth.com/auth)
if [ $STATUS_CODE -eq 404 ]; then

await in getter.

Since you can't make getters async in JavaScript classes it's impossible to do something like this:

class Foobar {
  set src(url) {
    this.src = url
    await this.fetchResults() // Unexpected keyword since the function isn't marked as `async`
  }

Keybase proof

I hereby claim:

  • I am koddsson on github.
  • I am koddsson (https://keybase.io/koddsson) on keybase.
  • I have a public key ASDwi_uJqSvD3Q_-HXzwzFS1lFeiI0w5tUbP4ayRTJK8Qwo

To claim this, I am signing this object:

#!/usr/bin/env bash
# fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run package.json "yarn"