I hereby claim:
- I am nghiatranuit on github.
- I am nghia (https://keybase.io/nghia) on keybase.
- I have a public key whose fingerprint is AF90 870B 392D 5C28 09F4 C83E 6D04 83A6 9D4D F328
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
First you will need to get an OAuth Token from GitHub using your own username and "note"
Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
// Compile-time selector checks. |
#import <Mantle.h> | |
@interface BaseModel : MTLModel <MTLJSONSerializing> | |
@property (nonatomic) int64_t id; | |
@property (nonatomic) NSTimeInterval createdUtc; | |
@property (nonatomic) NSTimeInterval modifiedUtc; | |
- (NSString *)createTableStatement; | |
- (NSString *)className; |
// Create text attachment | |
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; | |
textAttachment.image = [UIImage imageNamed:nameicon]; | |
textAttachment.bounds = CGRectMake(0, 0, 20, 16); | |
// Attribute | |
NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment]; | |
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithAttributedString:attrStringWithImage]; | |
// Change base line |
@interface UIImage (Orientation) | |
- (UIImage*)imageByNormalizingOrientation; | |
@end | |
@implementation UIImage (Orientation) | |
- (UIImage*)imageByNormalizingOrientation { |
secret = "xxx" | |
data = "http://someurl?someparams" | |
hmac = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret.encode("ASCII"), data.encode("ASCII")) | |
signature = Base64.encode64(hmac).chomp |