This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Without reminder: | |
:beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: :beer: | |
:beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: | |
:beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: | |
:beers: :beers: :beers: :beers: :beers: :beers: | |
:beers: :beers: :beers: :beers: :beers: :beers: | |
:beers: :beers: :beers: :beers: :beers: :beers: | |
:beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: | |
:beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: :beers: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DeviceUID.h | |
#import <Foundation/Foundation.h> | |
@interface DeviceUID : NSObject | |
+ (NSString *)uid; | |
@end | |
*/ | |
// Device.m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Creates an alias called "git hist" that outputs a nicely formatted git log. | |
# Usage is just like "git log" | |
# Examples: | |
# git hist | |
# git hist -5 | |
# git hist <branch_name> | |
# git hist <tag_name> -10 | |
## | |
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://coliru.stacked-crooked.com/a/481b444c09361f1d | |
#include <sstream> | |
#include <thread> | |
#include <cstdio> | |
#include <cstdarg> | |
#include <cwchar> | |
#include <cstdlib> | |
#include <windows.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::wstring StringConverter::StringToWideString(const std::string& s) { | |
int len = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.length(), NULL, 0); | |
std::wstring ws(L"", len); | |
wchar_t* pWSBuf = const_cast<wchar_t*>(ws.c_str()); | |
MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, pWSBuf, len); | |
return ws; | |
} | |
std::string StringConverter::WideStringToString(const std::wstring& ws) { | |
int len = WideCharToMultiByte(CP_UTF8, 0, ws.c_str(), ws.length(), 0, 0, NULL, NULL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated | |
{ | |
if (!self.manuallyChangingMap) { | |
BOOL updateRegion = NO; | |
MKCoordinateRegion restrictedRegion = [self restrictedRegion]; | |
if ((mapView.region.span.latitudeDelta > restrictedRegion.span.latitudeDelta * 4) || (mapView.region.span.longitudeDelta > restrictedRegion.span.longitudeDelta * 4) ) { | |
updateRegion = YES; | |
} | |
if (fabs(mapView.region.center.latitude - restrictedRegion.center.latitude) > restrictedRegion.span.latitudeDelta) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merge changes from remote github repository to your local repository | |
// https://help.github.com/articles/syncing-a-fork | |
// http://stackoverflow.com/q/867831/184646 | |
git remote add {name} {Public Clone URL} | |
git pull {name} master | |
git push | |
Undo commit not pushed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSString (TruncateToWidth) | |
- (NSString*)stringByTruncatingToWidth:(CGFloat)width withFont:(UIFont *)font; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIImage (ResizeImage) | |
+ (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MKMapRect zoomRect = MKMapRectNull; | |
for (id <MKAnnotation> annotation in mapView.annotations) { | |
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate); | |
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); | |
if (MKMapRectIsNull(zoomRect)) { | |
zoomRect = pointRect; | |
} else { | |
zoomRect = MKMapRectUnion(zoomRect, pointRect); | |
} | |
} |
NewerOlder