Skip to content

Instantly share code, notes, and snippets.

View interlock's full-sized avatar

June S interlock

  • Vancouver, British Columbia, Canada
View GitHub Profile
@interlock
interlock / keybase.md
Created January 11, 2021 23:11
keybase.md

Keybase proof

I hereby claim:

  • I am interlock on github.
  • I am pixelgirl (https://keybase.io/pixelgirl) on keybase.
  • I have a public key ASA3v9Z_Fn6n1gawsmql1d7MJyDh1cLya6IP1rdZByrrKgo

To claim this, I am signing this object:

@interlock
interlock / keybase.md
Created August 14, 2014 21:34
keybase.md

Keybase proof

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:

@interlock
interlock / example.js
Created January 22, 2014 06:25
My enumerable property is not enumerable
var Example = function() {
};
Object.defineProperty(Example.prototype,'message',{
enumerable: true,
set: function(v) {
this._message = v;
},
get: function() {

Units Jasmine

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.

Usage

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.

/* 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);
$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');
__block MDJTemplateDataSource *dataSource;
beforeEach(^{
dataSource = [[MDJTemplateDataSource alloc] init];
});
it(@"has parent MDJDataSource", ^{
[[[dataSource class] should] beMemberOfClass:[MDJDataSource class]];
});
@interlock
interlock / scape.js
Created May 23, 2012 19:09
Get notified when the game status changes on SaskatoonUltimate.org
// 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');
@interlock
interlock / gist:2424790
Created April 19, 2012 23:10
Mock with Stub that returns CGPoint
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
@interlock
interlock / AclBehavior.php
Created April 9, 2012 22:39
ACL Group Permissions, kills parent_id
// 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