"~" signifies the application's folder.
- ~/Library/WebKit/LocalStorage/file__0.localstorage
| /* to use WebSQL or the SQLite plugin (https://github.com/davibe/Phonegap-SQLitePlugin) with the same function) */ | |
| executeSqlBridge: function(tx, sql, params, dataHandler, errorHandler) { | |
| var self = this; | |
| if (typeof self.db.dbPath !== 'undefined') { | |
| //Native SQLite DB with phonegap : https://github.com/davibe/Phonegap-SQLitePlugin/ | |
| //this is a native DB, the method signature is different: | |
| var sqlAndParams = [sql].concat(params); | |
| var cb = function(res) { |
| /* | |
| You can now create a spinner using any of the variants below: | |
| $("#el").spin(); // Produces default Spinner using the text color of #el. | |
| $("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el. | |
| $("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color). | |
| $("#el").spin({ ... }); // Produces a Spinner using your custom settings. | |
| $("#el").spin(false); // Kills the spinner. |
| # xcode-build-bump.sh | |
| # @desc Auto-increment the build number every time the project is run. | |
| # @usage | |
| # 1. Select: your Target in Xcode | |
| # 2. Select: Build Phases Tab | |
| # 3. Select: Add Build Phase -> Add Run Script | |
| # 4. Paste code below in to new "Run Script" section | |
| # 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
| # 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |
| 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); | |
| } | |
| } |
| #import <UIKit/UIKit.h> | |
| @interface UIImage (ResizeImage) | |
| + (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size; | |
| @end |
| - (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) { |
| 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); |
| ## | |
| # 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" |
| /* DeviceUID.h | |
| #import <Foundation/Foundation.h> | |
| @interface DeviceUID : NSObject | |
| + (NSString *)uid; | |
| @end | |
| */ | |
| // Device.m |