Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Tietze DivineDominion

View GitHub Profile
View convert_dayone_to_org.rb
#!/usr/bin/env ruby
#
# convert_dayone_to_org.rb
# Copyright © 2020 Christian Tietze. All rights reserved. Distributed under the MIT License.
#
# Converts a Day One plain text export (Journal.txt) into org-mode journal format. It does
# - Markdown image conversion from ![](thepath.jpg) to [[thepath.jpg]]
# - Extraction of images from the front of an entry; moves it right after the property drawer.
# - Creation of nested year/month/day date sections (see example below)
#
@DivineDominion
DivineDominion / html-entity-insert.el
Last active Jul 30, 2020
Emacs lisp function to select a HTML entity from a filterable list and insert it at point. Based on Based on code by @emacs_gifs from https://emacsgifs.github.io/html-entities-helper
View html-entity-insert.el
;; Licensed under GNU/GPL. https://emacsgifs.github.io/html-entities-helper
(defun ct/html-entity-insert ()
"Select and insert an html entity.
Uses the list from https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references."
(interactive)
(defvar _html-entity-list
'("char: \" entity: " text: quotation mark (APL quote)"
"char: & entity: & text: ampersand"
"char: ' entity: ' text: apostrophe (apostrophe-quote); see below"
"char: < entity: &lt; text: less-than sign"
View About the gradual processing of thoughts while talking.md

About the gradual processing of thoughts while talking

If you want to know something and cannot find it through meditation, I advise you, my dear, meaningful friend, to talk about it with your nearest acquaintance, who will be upsetting you. It does not have to be a sharp-thinking head, nor do I mean it as if you should ask him about it: no! Rather, you should tell him yourself first of all. I see your eyes wide open, and you answer me that in your early years you were advised to speak of nothing but things you already understand. Others, I want you to speak out of a reasonable intention to instruct you, and so, in different cases, both rules of wisdom may well coexist. The Frenchman says, l'appétit vient en mangeant, and this principle of experience remains true if you parody it, and says, l'idee vient en parlant.

I often sit at my business table above the files and, in a complicated dispute, I explore the point of view from which it would like to be judged. I usually look into the light, as the brightest

@DivineDominion
DivineDominion / find_zettel_orphans.rb
Last active May 2, 2020
In a directory of Zettel notes, find all those without incoming links
View find_zettel_orphans.rb
#!/usr/bin/env ruby
require 'set'
# Change the path here:
ARCHIVE = '~/Archive/'
EXTENSIONS = %w{.md .txt .markdown .mdown .text}
#################################################################
@DivineDominion
DivineDominion / random_file.rb
Last active Apr 4, 2020
Find a random plain text file in a directory
View random_file.rb
#!/usr/bin/env ruby
# Usage: random_file.rb [options]
# -d, --dir [VALUE] Path to the note archive. Default: the current working directory.
# -c, --count [VALUE] Amount of unique random notes to fetch
# -h, --help Prints this help
require "optparse"
CURRENT_PATH = Dir.pwd
@DivineDominion
DivineDominion / gdcr2019.rb
Created Nov 16, 2019
A weird implementation idea for Game of Life
View gdcr2019.rb
#!/usr/bin/env ruby
require "rspec"
class God
def kill!(cell)
cell.sacrifice_to self
end
def surrender(process)
@DivineDominion
DivineDominion / execute.rb
Last active Oct 29, 2019
Extract note links from a source note
View execute.rb
#!/usr/bin/env ruby
# Avoid all the script configuration and use this convenience script instead!
#
# 1) Put it into the same folder,
# 2) run the script: `ruby _execute.rb PATH/TO/THE_NOTE.txt`
##################
# Configure here #
View keybase.md

Keybase proof

I hereby claim:

  • I am divinedominion on github.
  • I am ctietze (https://keybase.io/ctietze) on keybase.
  • I have a public key ASAeEXhO_3ukmYArB4BCULSfFFT-rpg6j_aXiWWv_zmBEwo

To claim this, I am signing this object:

@DivineDominion
DivineDominion / reswift-order.md
Created Jun 17, 2019
How to affect the order of subscription callbacks in ReSwift/Redux
View reswift-order.md

Affect the order/priority of subscription callbacks in ReSwift

(Reply to "Any way to control the priority of subscription callbacks?" https://github.com/ReSwift/ReSwift/issues/404)

ReSwift does not guarantee any subscription callback order. Since ReSwift uses an unordered Set as its subscription store, there's no reliable way to know when a subscription is invoked.

This implementation detail is hidden by design. If you find yourself wanting to affect the order of subscription callbacks, there's a concept of a sequence waiting to be extracted somehow.

These are the ways out:

@DivineDominion
DivineDominion / AppDelegate.swift
Created Dec 19, 2018
`NSAppearance` change notification when you cannot use `NSApp.effectiveAppearance` which is available for macOS 10.14+ only
View AppDelegate.swift
import Cocoa
import RxSwift
import RxCocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
let disposeBag = DisposeBag()
You can’t perform that action at this time.