Skip to content

Instantly share code, notes, and snippets.

View Playground.swift
import UIKit
// Line Height ----------------------------------------
let label = UILabel(frame: CGRectMake(0, 0, 300, 100))
label.numberOfLines = 0
label.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
label // Raw
@tdksk
tdksk / UIView+TDKUtil.m
Created Nov 27, 2014
UIView maskByRoundingCorners:cornerRadius:
View UIView+TDKUtil.m
#import "UIView+TDKUtil.h"
@implementation UIView (TDKUtil)
- (void)maskByRoundingCorners:(UIRectCorner)corners
cornerRadius:(CGFloat)cornerRadius
{
[self layoutIfNeeded];
UIBezierPath *maskPath;
@tdksk
tdksk / UILabel+TDKUtil.m
Created Nov 27, 2014
UILabel setLineHeightMultiple:
View UILabel+TDKUtil.m
#import "UILabel+TDKUtil.h"
@implementation UILabel (TDKUtil)
- (void)setLineHeightMultiple:(CGFloat)lineHeightMultiple
{
NSMutableAttributedString *attributedString = [self.attributedText mutableCopy];
NSMutableParagraphStyle *paragrahStyle = [NSMutableParagraphStyle new];
paragrahStyle.lineHeightMultiple = lineHeightMultiple;
View open-current-git-top-directory-in-tmux-new-pane.el
(defun git-top-directory ()
(file-name-as-directory
(replace-regexp-in-string
"\n" ""
(shell-command-to-string "git rev-parse --show-toplevel"))))
(defun open-current-git-top-directory-in-tmux-new-pane ()
(interactive)
(let ((top-dir (git-top-directory)))
(unless (file-directory-p top-dir)