This file contains 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
# Remap prefix to screens | |
unbind C-b | |
set -g prefix C-a | |
bind C-a send-prefix | |
# Quality of life stuff | |
set -g history-limit 10000 | |
set -g allow-rename off | |
## Join Windows |
This file contains 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
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] | |
//example use: self.view.backgroundColor = UIColorFromRGB(0xD2691E); |
This file contains 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
/** | |
* Returns the destination point from this point having travelled the given distance (in km) on the | |
* given initial bearing (bearing may vary before destination is reached) | |
* | |
* see http://williams.best.vwh.net/avform.htm#LL | |
* | |
* @param {Number} brng: Initial bearing in degrees | |
* @param {Number} dist: Distance in km | |
* @returns {LatLon} Destination point | |
*/ |
This file contains 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
NSURL *asseturl = [_asset valueForProperty:ALAssetPropertyAssetURL]; | |
__block ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init]; | |
[assetslibrary assetForURL:asseturl resultBlock:^(ALAsset *asset) { | |
__block ALAsset *weakAsset = [asset retain]; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { | |
@autoreleasepool { | |
This file contains 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
(1) loading the first page of 4 ads: | |
4 Ad objects (3.335s). | |
4 Ad objects (1.100s). | |
4 Ad objects (1.352s). | |
4 Ad objects (1.000s). | |
4 Ad objects (1.929s). | |
4 Ad objects (4.163s). | |
4 Ad objects (1.008s). | |
4 Ad objects (1.865s). |
This file contains 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
String.prototype.fulltrim = function(){ | |
return this.replace(/(?:((?:^|\n)(?:\s|,|\.|!)+)|((?:\s|,|\.|!)+(?:$|\n)))/g,''); | |
}; | |
Parse.Cloud.beforeSave("Ad", function(request, response) { | |
var itemDesc = request.object.get("itemDesc"); | |
request.object.set("itemDesc", itemDesc.fulltrim()); | |
response.success(); | |
}); |
This file contains 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
Parse.Cloud.define("NearByAds", nearByAds); | |
Parse.Cloud.define("myAds", myAds); | |
var locationUtil = require('cloud/latlon.js'); | |
/* | |
* limit is kInitialObjectsPerPageNum(100) | |
* oredered by descending adDate and createdAt | |
* kSpecialPropertyKeyApproved(approved) is YES | |
* kSpecialPropertyKeyDeleted(deleted) is NO |
This file contains 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
/* | |
* limit is kInitialObjectsPerPageNum(100) | |
* oredered by descending adDate and createdAt | |
* kSpecialPropertyKeyApproved(approved) is YES | |
* kSpecialPropertyKeyDeleted(deleted) is NO | |
* not showing ads with price under 100 | |
* | |
* params: | |
* kSpecialPropertyKeyUserID(userID) | |
* location_lat, location_long for kSpecialPropertyKeyLocation(location) |
This file contains 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
... | |
mainQuery.find({ | |
success:function(results){ | |
//'great finds' are given preferred sorting, their sort order is cut in half. | |
for(var i = 0; i<results.length; i++){ | |
if(results[i].get('ribbon')=='GREAT_FIND'){ | |
results.insert(i/2,results.remove(i).pop()); | |
} | |
} |
This file contains 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
//removes the last word number in an expression | |
-(NSString *)removeStreetNumber:(NSString *)string{ | |
string = [string stringByTrimmingCharactersInSet: | |
[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
// /s+:whitspace atleast one time, [0-9]*:as many time of numbers as you wish, $:the end of expression | |
NSRange range = [string rangeOfString:@"\\s+[0-9]*$" options:NSRegularExpressionSearch]; | |
if (range.length>0) { | |
return [string stringByReplacingCharactersInRange:range withString:@""]; |