Skip to content

Instantly share code, notes, and snippets.

View mgratzer's full-sized avatar
👨‍💻

Martin Gratzer mgratzer

👨‍💻
View GitHub Profile
extension NSSortDescriptor {
/// Usage:
/// NSSortDescriptor(
/// keyPath: \YourType.propertyName,
/// ascending: false
/// )
convenience init<T, U: Any>(keyPath: KeyPath<T, U>, ascending: Bool) {
self.init(
key: NSExpression(forKeyPath: keyPath).keyPath,
ascending: ascending
@mgratzer
mgratzer / shape-up.md
Created January 6, 2021 16:46
Some interesting text passages from the book Shape Up by https://twitter.com/rjs

Keybase proof

I hereby claim:

  • I am mgratzer on github.
  • I am mgratzer (https://keybase.io/mgratzer) on keybase.
  • I have a public key whose fingerprint is 1D29 624B 1C10 321C 4FFB 5884 EE2F 7165 234F D4F1

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am mgratzer on github.
  • I am mgratzer (https://keybase.io/mgratzer) on keybase.
  • I have a public key whose fingerprint is EB5E 4883 AC15 07DD B1A6 60B9 A988 891C 3AD7 196B

To claim this, I am signing this object:

@mgratzer
mgratzer / wpbackup.sh
Created December 7, 2012 09:34
Tiny shell script to backup WordPress on Dropbox. Schedule this script with cron and you'r done.
#!/bin/sh
NAME="blogname"
DIR="/var/www/blogfolder"
SQL="blogdatabase"
U="dbuser"
P="dbpassword"
NOW=$(date +"%m_%d_%Y")
FILE="$NAME.$NOW.tar.gz"
TARGET="/root/Dropbox/Backup/$FILE"
@mgratzer
mgratzer / mindmeister_tag.rb
Created July 23, 2012 08:20
A simple liquid tag plugin for displaying public http://www.mindmeister.com mind maps
# A simple liquid tag plugin for displaying public http://www.mindmeister.com mind maps
# Author: Martin Gratzer - @mgratzer
# Site: http://www.mgratzer.com
# Plugin License: MIT
#
# Usage: {% mindmeister ID,WIDTH,HEIGHT,ZOOM,LIVE_UPDATES,SHOW_SCROLLBARS %}
# Example: {% mindmeister 2529908,600,400,1.0,1,1 %}
module Jekyll
class MindMeisterTag < Liquid::Tag
@mgratzer
mgratzer / pptxml2hrm.rb
Created September 20, 2011 06:29
Simple script to convert HRM data from XML documents exported via http://www.personaltrainer.com (e.g. for use with RunKeeper)
require 'rexml/document'
def file_name(file)
if file.end_with?(".xml") then
file = file.gsub(".xml", ".hrm")
else
file = "#{file}.hrm"
end
return file
end