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
// create a date | |
OKDate* a = [OKDate dateWithNumbers:@[2013, 6, 16, 8, 0, 0]]; | |
[a addDays:2]; //add 2 days | |
a.minute = 30; //set minutes to 30 | |
// render to "2013-06-18 8:30AM" | |
NSString* b = [a format:@"yyyy-MM-dd H:mma"]; | |
// parse a date |
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
#import <UIKit/UIKit.h> | |
@interface UIViewController (AlwaysAnimation) | |
- (void) alwaysAnimate:(CABasicAnimation*)animation view:(UIView*)view; | |
@end |
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
// | |
// NSWeakTimer.m | |
#import "NSWeakTimer.h" | |
@interface NSWeakTimerTarget : NSObject | |
@property (assign) id target; | |
@property (assign) SEL selector; | |
@property (assign) NSTimer* timer; |
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
/*! | |
* jQuery Tiny Pub/Sub - v0.X - 11/18/2010 | |
* http://benalman.com/ | |
* | |
* Original Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
* | |
* Made awesome by Rick Waldron | |
* |
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
// | |
// ALAssetRepresentation+SaveToDisk.m | |
// | |
// Adapted from http://damir.me/import-video-from-alasset | |
// | |
// Created by Joshua Wright<@BendyTree> on 12/17/13. | |
// http://www.joshwright.com | |
// | |
#import "ALAssetRepresentation+SaveToDisk.h" |
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
(function(){ | |
//create a select so we can access the selectpicker | |
var $div = $("<div><select></select></div>"); | |
//get the prototype | |
var prototype = $div.find("select").selectpicker().data("selectpicker").constructor.prototype; | |
//keep track of the original setStyle |
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
/** | |
* Originally this code was from: | |
* https://github.com/virtualstaticvoid/highcharts_trendline | |
* | |
* But it dropped a lot in the global namespace, so I added a closure and exposed: | |
* | |
* window.BuildHighChartsTrendLineSeriesFromSeries(series); | |
* | |
* If you want, I can make the name longer. | |
* |
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
/* | |
* ObjectIdAsString | |
* | |
* A SchemaType for MongooseJS that acts exactly like an ObjectId except that | |
* the field is handled as a string in the mongoose document. | |
* | |
* NOTE: If a document is fetched with `lean:true` then the field is not converted | |
* to a string. Ugh. | |
* | |
* //register the type |
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
/** | |
* Josh Wright <@BendyTree> | |
* http://www.joshwright.com | |
* | |
* MIT | |
* | |
* | |
* Standard MongooseJS validation looks like this: | |
* | |
* schema.path("email").validate(function(val, callback){ |
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
var async = require('async'); | |
var https = require('https'); | |
async.times(5, function(n, cb){ | |
var options = { host: 'www.google.com', port: 443, path: '', method: 'GET' }; | |
var startTime = new Date().getTime(); | |
var req = https.request(options, function(res) { | |
var ms = new Date().getTime() - startTime; | |
console.log(ms+"ms"); | |
res.on('data', function(){ }); |
OlderNewer