Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@johnjohndoe
johnjohndoe / AppDelegate.m
Created November 19, 2012 16:22
How to use NSSelectorNameBindingOption with an NSButton
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize button = m_button;
- (void)awakeFromNib {
NSDictionary* options = [NSDictionary dictionaryWithObject:@"buttonClicked" forKey:NSSelectorNameBindingOption];
[m_button bind:@"target" toObject:self withKeyPath:@"self" options:options];
@johnjohndoe
johnjohndoe / AppDelegate.m
Created November 19, 2012 16:24
How to bind two NSTextField instances to one NSString member
@implementation AppDelegate
@synthesize window = _window;
@synthesize textField1 = m_textField1;
@synthesize textField2 = m_textField2;
@synthesize foo = m_foo;
- (id)init {
self = [super init];
if (self) {
@johnjohndoe
johnjohndoe / rezept-schichtsalat.md
Last active April 22, 2020 08:22
Schichtsalat Rezept

Schichtsalat

Zutaten

  • 1 Glas, 350 ml, Selleriesalat geraspelt
  • 1 Dose Mais
  • 4 Scheiben gekochter Schicken, würfeln
  • 4 hartgekochte Eier
  • 2 mittlere Äpfel würfeln, z.B. Boskopp
  • 1 Glas MiracleWhip, 500 ml
@johnjohndoe
johnjohndoe / download-url-to-file.rb
Last active March 14, 2024 17:58
Ruby script to download a number of files from individual URLs via HTTP/HTTPS/FTP specified in an external file.
#!/usr/bin/env ruby
#
# Ruby script to download a number of files
# from individual URLs via HTTP/HTTPS/FTP
# specified in an external file.
#
# Author: Tobias Preuss
# Revision: 2013-04-18 16:26 +0100 UTC
# License: Creative Commons Attribution-ShareAlike 3.0 Unported
@johnjohndoe
johnjohndoe / download.rb
Created December 16, 2012 17:46 — forked from leecade/download.rb
Replace hard coded file name with environment variable.
#!/usr/bin/env ruby
# An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile's
# HTTP implementation.
#
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2012-03-25 21:18:59 -0600
require 'net/http'
require 'net/https' if RUBY_VERSION < '1.9'
@johnjohndoe
johnjohndoe / shrinkpdf.sh
Last active December 10, 2015 00:49
Shell script to shrink the size of PDF using ghostscript.
#!/bin/sh
#
# Source: http://www.alfredklomp.com/programming/shrinkpdf/
gs -q -dNOPAUSE -dBATCH -dSAFER \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.3 \
-dPDFSETTINGS=/screen \
-dEmbedAllFonts=true \
-dSubsetFonts=true \
@johnjohndoe
johnjohndoe / delicious2013.css
Last active December 11, 2015 07:38
Custom stylesheet to change the look of the delicious.com website after it has been relaunched in early 2013.
/*
delicious.com - Custom styles 2013
Author: Tobias Preuss
Version: 2013-01-18 20:40
License: Creative Commons Attribution (CC BY)
Userstyles: http://userstyles.org/styles/81715/delicious-com-custom-styles-2013
Stylish browser add-on
for Firefox: https://addons.mozilla.org/en-US/firefox/addon/stylish/
@johnjohndoe
johnjohndoe / delicious.js
Last active July 25, 2017 13:49
Bookmarklet of del.icio.us. Latest version available at https://del.icio.us/tools. This Gist tracks the changes made to the script. Javascript is formatted via http://jsbeautifier.org. - The authors of the script are the guys from del.icio.us.
javascript: (function($) {
var bookmarklet = document.getElementById(
'DELI_save_link_slidedown');
if (bookmarklet) {
$('#DELI_mist').show();
$('#DELI_save_link_slidedown').slideDown('normal');
return
};
if (!window.jQuery) {
node = document.createElement('SCRIPT');
@johnjohndoe
johnjohndoe / VimColorTest.vim
Created January 21, 2013 23:30
VimColorTest script to test Vim for 256 colors support. Place the script into ~/.vim/plugin/ and run it via :VimColorTest.
" Source: http://emerg3nc3.wordpress.com/2012/07/28/full-256-color-support-for-vim-andor-xterm-on-ubuntu-12-04/
"
" Color test: Save this file, then enter ':so %'
" Then enter the following commands:
" :VimColorTest "(for console/terminal Vim)
function! VimColorTest(outfile, fgend, bgend)
let result = []
for fg in range(a:fgend)
for bg in range(a:bgend)
let kw = printf('%-7s', printf('c_%d_%d', fg, bg))
@johnjohndoe
johnjohndoe / ShellColorTest.py
Created January 21, 2013 23:34
ShellColorTest script to test the shell for 256 colors support. Run the script via /path/to/script/ShellColorTest.py.
#!/usr/bin/env python
# Copyright (C) 2006 by Johannes Zellner, <johannes@zellner.org>
# modified by mac@calmar.ws to fit my output needs
# modified by crncosta@carloscosta.org to fit my output needs
# Source: http://emerg3nc3.wordpress.com/2012/07/28/full-256-color-support-for-vim-andor-xterm-on-ubuntu-12-04/
import sys
import os
def echo(msg):