Skip to content

Instantly share code, notes, and snippets.

June S interlock

  • Vancouver, British Columbia, Canada
Block or report user

Report or block interlock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am interlock on github.
  • I am 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 / example.js
Created Jan 22, 2014
My enumerable property is not enumerable
View example.js
var Example = function() {
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.


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.

View ConfigureRestKit.m
/* Also called from the AppDelegate */
- (void)configureRestKit {
// Init RestKit and Map Models
RKObjectManager *manager = [RKObjectManager managerWithBaseURLString:@""];
manager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES;
[[RKClient sharedClient] setCachePolicy:RKRequestCachePolicyNone];
[[RKClient sharedClient] setValue:[[NSUserDefaults standardUserDefaults] stringForKey:@"UUID"] forHTTPHeaderField:@"App-UUID"];
RKLogConfigureByName("RestKit/Network*", RKLogLevelTrace);
View weather_block.php
$weather = false;
if ( $this->Session->check('') ) {
$UserModel = new User();
$user = $UserModel->find('first',array('conditions'=>array(''=>$this->Session->read('')),'contain' => array('FarmleadProfile')));
if ( !empty($user) && !empty($user['FarmleadProfile'])) {
// construct address
$address = 'Saskatoon/SK/Canada';
$weather = $weatherLib->fetchWeather('autoip');
View spec.m
__block MDJTemplateDataSource *dataSource;
dataSource = [[MDJTemplateDataSource alloc] init];
it(@"has parent MDJDataSource", ^{
[[[dataSource class] should] beMemberOfClass:[MDJDataSource class]];
interlock / scape.js
Created May 23, 2012
Get notified when the game status changes on
View scape.js
// install some dependencies
// npm install jsdom request growler
// run: node scrape.js
var jsdom = require('jsdom'),
request = require('request'),
growler = require('growler');
interlock / gist:2424790
Created Apr 19, 2012
Mock with Stub that returns CGPoint
View gist:2424790
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 / AclBehavior.php
Created Apr 9, 2012
ACL Group Permissions, kills parent_id
View AclBehavior.php
// 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
interlock / Profile.php
Created Mar 26, 2012
virtual fields, pagination with conditions on those virtual fields
View Profile.php
class Profile extend AppModel {
var $belongsTo = array('User');
var $virtualFields = array(
'full_name' => 'CONCAT(`Profile`.`first_name`, ' ', `Profile`.`last_name`)'
You can’t perform that action at this time.