Skip to content

Instantly share code, notes, and snippets.

View phynet's full-sized avatar
🤘
I said yeah.

Sofia Swidarowicz phynet

🤘
I said yeah.
View GitHub Profile
@phynet
phynet / sharing-pods-in-diff-targets.rb
Last active February 23, 2016 14:22
Sharing pods between targets
#platform :ios, '8.0'
def shared_pods
pod 'Parse'
pod 'RNCryptor', '3.0.1', :inhibit_warnings => true
pod 'SSKeychain'
end
target 'MyApp' do
@phynet
phynet / attributed_UILabel.m
Last active January 13, 2016 08:09
Category to create an attributed label for Obj-c
@implementation UILabel (AttributedLabel)
-(NSAttributedString*)spaceBetweenChars:(int)spaceValue{
NSMutableAttributedString *attributedString;
attributedString = [[NSMutableAttributedString alloc] initWithString:self.text];
[attributedString addAttribute:NSKernAttributeName value:@(spaceValue) range:NSMakeRange(0, 0)];
[self setAttributedText:attributedString];
return self.attributedText;
@phynet
phynet / Change tint color for status bar to WHITE with SWIFT.mkd
Last active March 16, 2016 05:51
Change tint color for status bar to WHITE with SWIFT

Put this inside your app info.plist:

  • View controller-based status bar appearance = NO

  • Status bar style = UIStatusBarStyleLightContent

And inside AppDelegate

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

@phynet
phynet / UIView-shadow.m
Created December 21, 2015 15:22
Create a shadow under a uiview
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.menuView.bounds];
self.menuView.layer.masksToBounds = NO;
self.menuView.layer.shadowColor = [UIColor blackColor].CGColor;
self.menuView.layer.shadowOffset = CGSizeMake(0.0f, 0.5f);
self.menuView.layer.shadowOpacity = 0.75f;
self.menuView.layer.shadowPath = shadowPath.CGPath;
@phynet
phynet / DictionaryToArray.js
Created December 11, 2015 09:14
Create an array with dictionary values in JAVASCRIPT
var array = [];
for (key in dictPush){
temp = {};
temp[key] = dictPush[key];
array.push(temp);
}
@phynet
phynet / deviceToken.m
Last active May 27, 2017 13:51
Get iOS device token for push notification
NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"]];
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"Device Token %@: ", token);
@phynet
phynet / parse.js
Created November 11, 2015 07:17
To know which column/property has been changed in beforeSave in PARSE
for (var i in userPoints.dirtyKeys()) {
var dirtyKey = userPoints.dirtyKeys()[i];
alert("DIRTY KEY val " + dirtyKey);
}
Make shortcut keyboard to open Terminal from Mac osx
https://claudiodangelis.com/2012/osx-launch-terminal-from-shortcut/
NSDate *animationStart = [NSDate date];
NSTimeInterval pendingTime = MAX(2 - [[NSDate date] timeIntervalSinceDate:animationStart], 0);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(pendingTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//call a method .... do something
});
//DISPATCH_TIME_NOW is a constant declared in dispatch class from iOS 9
let orderedSet = NSOrderedSet(array: [ 42, 43, 44])
var enumarator = orderedSet.reversedOrderedSet
print(enumarator)
for elem in orderedSet {
print("elements \(elem)")
}