Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@johnjohndoe
johnjohndoe / AppDelegate.m
Created Nov 19, 2012
How to use NSSelectorNameBindingOption with an NSButton
View AppDelegate.m
#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 Nov 19, 2012
How to bind two NSTextField instances to one NSString member
View AppDelegate.m
@implementation AppDelegate
@synthesize window = _window;
@synthesize textField1 = m_textField1;
@synthesize textField2 = m_textField2;
@synthesize foo = m_foo;
- (id)init {
self = [super init];
if (self) {
View rezept-schichtsalat.md

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 Aug 28, 2021
Ruby script to download a number of files from individual URLs via HTTP/HTTPS/FTP specified in an external file.
View download-url-to-file.rb
#!/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 Dec 16, 2012 — forked from leecade/download.rb
Replace hard coded file name with environment variable.
View download.rb
#!/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 Dec 10, 2015
Shell script to shrink the size of PDF using ghostscript.
View shrinkpdf.sh
#!/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 Dec 11, 2015
Custom stylesheet to change the look of the delicious.com website after it has been relaunched in early 2013.
View delicious2013.css
/*
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 Jul 25, 2017
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.
View delicious.js
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 Jan 21, 2013
VimColorTest script to test Vim for 256 colors support. Place the script into ~/.vim/plugin/ and run it via :VimColorTest.
View VimColorTest.vim
" 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 Jan 21, 2013
ShellColorTest script to test the shell for 256 colors support. Run the script via /path/to/script/ShellColorTest.py.
View 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):