Skip to content

Instantly share code, notes, and snippets.

@tmalsburg
tmalsburg / vcard2org-contacts.py
Last active August 13, 2023 00:02
A simple script for converting vCard files to org-contacts.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written by Titus von der Malsburg <malsburg@posteo.de>, March 2014.
# This is a simple script for converting vCard files to
# org-contacts. There is one mandatory argument: the name of the
# vCard file. The result is printed to standard out.
# Usage:
@igable
igable / watch.rb
Last active December 31, 2015 16:29
The code below is taken entirely from a post by Brett Terpstra located at: http://brettterpstra.com/2011/03/07/watch-for-file-changes-and-refresh-your-browser-automatically/ This version below is modified to work better with Jekyll (see comment below)
#!/usr/bin/env ruby
# watch.rb by Brett Terpstra, 2011 <http://brettterpstra.com>
# with credit to Carlo Zottmann <https://github.com/carlo/haml-sass-file-watcher>
trap("SIGINT") { exit }
if ARGV.length < 2
puts "Usage: #{$0} watch_folder keyword"
puts "Example: #{$0} . mywebproject"
exit
@fractaledmind
fractaledmind / Markdown Outline to Numbered Outline
Last active August 31, 2018 06:02
This script translates simple Markdown outlines into formatted numeral outlines. This script works from the clipboard, so it is totally application agnostic. This newest version allows for Outline Text along with your Markdown outline items and allows you to use any Markdown symbol for your outline ("*", "-", etc.)
(* CONVERT MARKDOWN LIST TO NUMERAL OUTLINE
-- Stephen Margheim
-- open source
This script translates simple Markdown outlines into formatted numeral outlines. For example, an outline of the the form:
- item 1
- sub-item 1
- sub-sub-item 1
- sub-sub-sub-item 1
- sub-item 2
@tommcfarlin
tommcfarlin / meta-data-serialization.php
Last active November 4, 2022 00:28
An example function used to demonstrate how meta data is typically saved in a WordPress theme or plugin. The gist is made public so that developers can contribute to the standard security boilerplate functionality in order to simplify, reduce, and improve our serialization functions.
<?php
/**
* An example function used to demonstrate how to use the `user_can_save` function
* that provides boilerplate security checks when saving custom post meta data.
*
* The ultimate goal is provide a simple helper function to be used in themes and
* plugins without the need to use a set of complex conditionals and constants.
*
* Instead, the aim is to have a simplified function that's easy to read and that uses
* WordPress APIs.