Skip to content

Instantly share code, notes, and snippets.

View matthiaswenz's full-sized avatar
:octocat:

Matthias Wenz matthiaswenz

:octocat:
  • Germany
  • 00:48 (UTC +01:00)
View GitHub Profile
# encoding: utf-8
xml.instruct!
xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
page_count = 0
sitemap.resources.each do |page|
catch :next_page do
# Exclude images, metadata, config, ...
throw :next_page if page.url.start_with?('/images/')

Keybase proof

I hereby claim:

  • I am ranterle on github.
  • I am ranterle (https://keybase.io/ranterle) on keybase.
  • I have a public key whose fingerprint is A29F C4DF B112 69A7 88E7 B568 51F8 5115 BFDA 44B8

To claim this, I am signing this object:

@matthiaswenz
matthiaswenz / gist:8088229
Last active January 1, 2016 03:49
UISearchBar customize Keyboard Return button type (iOS 7)
for (UIView *subview in searchBar.subviews) {
for (UIView *subSubview in subview.subviews) {
if ([subSubview conformsToProtocol:@protocol(UITextInputTraits)]) {
UIView<UITextInputTraits> *textInputField = (UIView<UITextInputTraits> *)subSubview;
textInputField.returnKeyType = UIReturnKeyDone;
break;
}
}
}
@matthiaswenz
matthiaswenz / user.css
Last active December 18, 2015 17:59
User Stylesheet entry to make 37signals' launchbar in Basecamp (BCX) a little easier on the eyes.
#launchbar {
opacity: 0.1;
-webkit-transition: opacity .2s ease-in-out;
-moz-transition: opacity .2s ease-in-out;
transition: opacity .2s ease-in-out;
}
#launchbar:hover {
opacity: 1.0;
@matthiaswenz
matthiaswenz / NSDictionary+Localized.h
Last active December 13, 2015 22:19
A simple category on NSDictionary which allows localized values for string-based keys, built for @bowstreet. License: MIT - go on, have fun with it, but don't expect anything from us. You might ask politely, though - we're a nice bunch.
#import <Foundation/Foundation.h>
@interface NSDictionary (Localized)
- (id)localizedValueForKey:(NSString *)aKey;
- (id)localizedValueForKey:(NSString *)aKey withLanguage:(NSString *)aLanguage;
@end
/*
Calculation to center diagonal separator:
new width of the :before-element after the rotation (Pythagoras) = 25.46px
add space to the right to visual center diagonal line: 25,46px / 2 = 12.73px
total amount for A: 25.46px + 12.73px = 38.19px
revise position of B: ( 25.46px - 18px ) / 2 = 3.73px;
change gap by adding half amount to B (+9px) than to A (+18px)
slightly change for visual perfection
@matthiaswenz
matthiaswenz / SHA1FromFile.m
Created December 20, 2011 11:46
SHA1FromFile
#import <CommonCrypto/CommonDigest.h>
@implementation SHA1FromFile
+ (NSString *)sha1FromFileAtPath:(NSString *)path {
CFReadStreamRef readStream = CFReadStreamCreateWithFile(kCFAllocatorDefault, CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
(CFStringRef)path,
kCFURLPOSIXPathStyle,
(Boolean)false));