Skip to content

Instantly share code, notes, and snippets.

@youssman
youssman / underlineUILabel.m
Last active August 29, 2015 14:19
Underline UILabel
NSDictionary *underlineAttribute = @{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)};
myLabel.attributedText = [[NSAttributedString alloc] initWithString:@"Underline UILabel text" attributes:underlineAttribute];
@youssman
youssman / dynamicSize.m
Created November 5, 2015 15:19
Calculates and returns the bounding rect for the receiver
-(CGSize)frameForText:(NSString*)text sizeWithFont:(UIFont*)font constrainedToSize:(CGSize)size lineBreakMode:(NSLineBreakMode)lineBreakMode {
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.lineBreakMode = lineBreakMode;
NSDictionary * attributes = @{NSFontAttributeName:font,
NSParagraphStyleAttributeName:paragraphStyle
};
@youssman
youssman / bash-it.sh
Created August 27, 2017 17:16
Script to install Bash-it on Vagrant provisioning (Ubuntu box)
#!/usr/bin/env bash
# Using bento/ubuntu-14.04 vm box and Vagrant v1.9.8
# Corresponding line in Vagrantfile: config.vm.provision "shell", path: "bash-it.sh", privileged: false
# https://github.com/Bash-it/bash-it
# https://www.vagrantup.com
export DEBIAN_FRONTEND=noninteractive
# Clonning bash-it repo