I hereby claim:
- I am interlock on github.
- I am jamessapara (https://keybase.io/jamessapara) on keybase.
- I have a public key whose fingerprint is 98D3 809F EFF8 2124 FEF5 3E36 A8C5 6C69 B873 7F17
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<?php | |
class Profile extend AppModel { | |
var $belongsTo = array('User'); | |
var $virtualFields = array( | |
'full_name' => 'CONCAT(`Profile`.`first_name`, ' ', `Profile`.`last_name`)' | |
); |
// this is a snip from a Behavior I wrote that overrides afterSave(...) from the AclBehavior. | |
// This solves having multiple instances of your model in the ACO/ARO trees. I'm not really sure "what" | |
// the point of updating an ACO/ARO is in the $created == true case is unless you have defined a single "Group" | |
// inheritance as they show in the docs. Clearly that isn't ideal for some setups, but changing the current | |
// implementation could break a lot of sites (I actually would want to see a complex case that proves that, I'm only | |
// "told" that is the case). At any rate, in my case I'll take care of updating all the other ACO/ARO's that are not | |
// at the default parent node for the model. | |
// This appears to be a purposeful limitation to basically allow "grouping" but not multiple grouping. In theory |
it(@"touch event mock setup", ^{ | |
UITouch *touchMock = [UITouch mock]; // this is important, it has the selector signature to cast the return type | |
CGPoint source = CGPointMake(5.0, 5.0); | |
[touchMock stub:@selector(locationInView:)andReturn:theValue(source)]; | |
NSSet *set = [NSSet setWithObject:touchMock]; | |
CGPoint pow = [touchMock locationInView:nil]; | |
[[theValue(pow.x) should] equal:5.0 withDelta:0.1]; | |
}); | |
// vs |
// install some dependencies | |
// npm install jsdom request growler | |
// | |
// run: node scrape.js | |
var jsdom = require('jsdom'), | |
request = require('request'), | |
growler = require('growler'); | |
console.log('init'); |
__block MDJTemplateDataSource *dataSource; | |
beforeEach(^{ | |
dataSource = [[MDJTemplateDataSource alloc] init]; | |
}); | |
it(@"has parent MDJDataSource", ^{ | |
[[[dataSource class] should] beMemberOfClass:[MDJDataSource class]]; | |
}); |
$weather = false; | |
if ( $this->Session->check('Auth.User.id') ) { | |
App::uses('User','Model'); | |
$UserModel = new User(); | |
$user = $UserModel->find('first',array('conditions'=>array('User.id'=>$this->Session->read('Auth.User.id')),'contain' => array('FarmleadProfile'))); | |
if ( !empty($user) && !empty($user['FarmleadProfile'])) { | |
// construct address | |
$address = 'Saskatoon/SK/Canada'; | |
$weather = $weatherLib->fetchWeather('autoip'); |
/* Also called from the AppDelegate */ | |
- (void)configureRestKit { | |
// Init RestKit and Map Models | |
RKObjectManager *manager = [RKObjectManager managerWithBaseURLString:@"http://example.com/api"]; | |
manager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
[[RKClient sharedClient] setCachePolicy:RKRequestCachePolicyNone]; | |
[[RKClient sharedClient] setValue:[[NSUserDefaults standardUserDefaults] stringForKey:@"UUID"] forHTTPHeaderField:@"App-UUID"]; | |
RKLogConfigureByName("RestKit/Network*", RKLogLevelTrace); |
My hack to output a CSV of Specs and estimates associated to them. I used this for a project that we wrote stub specs for instead of a requirements document for. Ultimately, needed to get a general idea of the amount of work, so created this Jasmine plugin.
This is for jasmine specs that run within node.js. It will not work in a browser.
Within any "it" spec, call units(x) to associate an estimated number of work units for that spec. The units are whatever you use to do project planning, in my case, 0,1,2,4,8.
var Example = function() { | |
}; | |
Object.defineProperty(Example.prototype,'message',{ | |
enumerable: true, | |
set: function(v) { | |
this._message = v; | |
}, | |
get: function() { |