Skip to content

Instantly share code, notes, and snippets.

View WedgeSparda's full-sized avatar
🏠
Working from home

Roberto Pastor WedgeSparda

🏠
Working from home
View GitHub Profile
@WedgeSparda
WedgeSparda / FlexibleTextView.swift
Created June 19, 2018 09:08
Flexible UITextView with minimum and maximum number of lines using AutoLayout
import UIKit
class FlexibleTextView: UITextView {
// MARK: - Properties
var minNumberOfLines: Int = 5 {
didSet {
if minNumberOfLines > maxNumberOfLines {
minNumberOfLines = oldValue
}
@WedgeSparda
WedgeSparda / CombineImages.m
Last active December 7, 2015 10:30
Combine two UIImages
// Let’s say we have two images we want to combine; say an image of a person that we want to overlay an image of a funny hat on to.
// Here are the two UIImages:
UIImage *personImage = [UIImage imageNamed:@"person.jpg"];
UIImage *hatImage = [UIImage imageNamed:@"hat.png];
// In this case we want the resultant image to be that same size as the personImage.
// Let’s get the size that we want for the final image:
CGSize finalSize = [personImage size];
// You need to subclass this and populate the main method
// To complete the operation call [self completeOperation]
#import <Foundation/Foundation.h>
@interface AsyncOperation : NSOperation
- (void)completeOperation;
@end
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
@interface VisualizerView : UIView
@property (strong, nonatomic) AVAudioPlayer *audioPlayer;
@property (nonatomic, assign) NSInteger numberOfBars;
@end
@WedgeSparda
WedgeSparda / AnimationView.h
Last active August 29, 2015 14:26
Custom UIView with animation.
// Got from https://stackoverflow.com/questions/10809280/drawrect-circle-and-animate-size-color/10809496#10809496
#import <UIKit/UIKit.h>
// Use IB_DESIGNABLE if you want to see your custom view in Interface Builder (Storyboard or XIB)
IB_DESIGNABLE
@interface AnimationView : UIView
@end
@WedgeSparda
WedgeSparda / UIViewControllerFromStoryboard.m
Last active August 29, 2015 14:05
Load a UIViewController from a Storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"storyboardName" bundle:nil];
// viewControllerID is set on the Identity Inspector, on Storyboard ID field.
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"viewControllerID"];
@WedgeSparda
WedgeSparda / config.rb
Last active August 29, 2015 14:04
My Compass config.rb file
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"
preferred_syntax = :scss
relative_assets = true
line_comments = true
# output_style = :compressed

Keybase proof

I hereby claim:

  • I am WedgeSparda on github.
  • I am rpastor (https://keybase.io/rpastor) on keybase.
  • I have a public key whose fingerprint is F4F7 497C 4340 F978 7FF0 BBE2 0441 78C0 E849 F554

To claim this, I am signing this object: