Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@johnjohndoe
johnjohndoe / excel-time-to-hours-conversion.md
Created June 11, 2015 09:04
Excel: Umrechnung von Uhrzeit in Stunden

Allgemein

=WENN(Uhrzeit_Anfang<>"";(Uhrzeit_Ende - Uhrzeit_Anfang)*24-Pause/60;"")

Beispiel

=WENN(C11<>"";(D11-C11)*24-G11/60;"")

Hacking in a material world

Challenge

We will be playing with android's gorgeous new Material Design theme. We will be covering the following material widgets and animations that were introduced in Android 5.0 (API level 21).

@johnjohndoe
johnjohndoe / Devices.java
Last active September 12, 2015 08:26
Helper class to get the consumer friendly device name.
/*
* Copyright (C) 2015 Jared Rummler <jared.rummler@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@johnjohndoe
johnjohndoe / gist:723302
Created December 1, 2010 10:27
Colored bash prompt showing git branch (.bash_rc)
# Set git tab completion and PS1 integration
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
. /usr/local/git/contrib/completion/git-completion.bash
fi
GIT_PS1_SHOWDIRTYSTATE=true
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
@johnjohndoe
johnjohndoe / gist:1007379
Created June 3, 2011 23:54
Java introspection for class name and function name
// Print name of the current function.
new Throwable().fillInStackTrace().getStackTrace()[0].getMethodName();
// Print simple class name.
getClass().getSimpleName();
// Print full class name.
getClass().getName();
@johnjohndoe
johnjohndoe / gist:1024839
Created June 14, 2011 13:01
Convert from NSRect to CGRect
// Convert from NSRect to CGRect.
NSRect baz = NSMakeRect(0, 0, 100, 100);
CGRect foo = *(CGRect*)&baz;
// Include this inline function in a header file.
NS_INLINE CGRect CGRectMakeFromNSRect(NSRect rect) {
return *(CGRect*)&rect;
}
// Doooooh! They already exist.. - I could not find 'em before.
@johnjohndoe
johnjohndoe / gist:3754453
Created September 20, 2012 07:36 — forked from gnunicorn/gist:3748738
Git for Beginners: Call for Coaches

The OpenTechSchool has set up and hosted a few tech workshops and meetups here in Berlin now. Aside from the monthly Beginners Meetup and hosting the Udacity Global Meetup we hosted workshops for program beginners in Python and Javascript on our own and on the premise of CampusParty.

One thing that was extraordinary popular on CampusParty was the Workshop on Git for beginners. And we decided to do it again, this time with a closer focus on version control as a major benefit in code sharing (by using git and github) for beginners - free of charge.

So if you are interested in

@johnjohndoe
johnjohndoe / Host.m
Created September 25, 2012 15:31
Objective-C: Conversion of NetService addresses into human readable IP addresses.
//
// Host.m
// Dependencies: NSString+HexValue - Source: http://forums.macrumors.com/showthread.php?t=977076
//
#import "Host.h"
#import "NSString+HexValue.h"
#pragma mark
@interface Host()
#!/usr/bin/env ruby
require "rubygems"
require "xml/libxml"
require "uri"
require "net/http"
require "time"
URL = "http://conference.opensuse.org/indico//conferenceOtherViews.py?confId=2&view=xml&fr=no"
@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];