Skip to content

Instantly share code, notes, and snippets.

View romanr's full-sized avatar
😶

Roman Roan romanr

😶
View GitHub Profile
@romanr
romanr / UITableViewCell.m
Created June 27, 2012 10:07 — forked from pier-oliviert/UITableViewCell.m
UITableViewCell subclass to handle indentationLevel
- (void)layoutSubviews {
[super layoutSubviews];
float indentPoints = self.indentationLevel * self.indentationWidth;
if (indentPoints > 0) {
[self.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
UIView *view = (UIView *)obj;
CGFloat width = CGRectGetWidth(view.frame);
if (width > indentPoints * 2)
width -= indentPoints;
CGFloat x = CGRectGetMinX(view.frame);
import org.apache.commons.lang.StringUtils;
private String computeMD5(String string) throws NoSuchAlgorithmException {
byte[] stringBytes = string.getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(stringBytes, 0, stringBytes.length);
String md5 = new BigInteger(1, messageDigest.digest()).toString(16);
md5 = StringUtils.leftPad(md5, 32, '0');