Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
@erichocean
erichocean / target_action.js
Created January 27, 2011 21:38
Mixin to your custom views and call this.performAction(evt) at the appropriate time.
// ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
// Portions ©2008-2009 Apple, Inc. All rights reserved.
// License: Licened under MIT license (see license.js)
// ==========================================================================
/** @static
This mixin implements the basic target-action handling for a custom view.

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For less, I'm using the ruby version because this is what they suggest on the website. The javascript version may be different.

Variables

@erichocean
erichocean / gist:799195
Created January 27, 2011 20:32 — forked from bxjx/gist:583836
how to create data-uris for images in node.js
var express = require('express'),
request = require('request'),
BufferList = require('bufferlist').BufferList,
sys = require('sys');
var app = express.createServer(
express.logger(),
express.bodyDecoder()
);
#!/bin/sh
#
# Deploys documentation
getGitBranchName()
{
branch="$(git symbolic-ref HEAD 2>/dev/null)" ||
"$(git describe --contains --all HEAD)"
echo ${branch##refs/heads/}
}
@erichocean
erichocean / custom_binding.js
Created January 20, 2011 18:56
How to transform the status property of a content object for use by a view.
valueBinding: SC.Binding.transform(function(value, binding) {
if (value === SC.Record.READY_DIRTY ||
value === SC.Record.READY_NEW) {
return YES;
} else return NO;
}).from('Todos.taskController.status')
contentView: OI.MailboxSourceView.design({
layerId: 'mailbox-list',
classNames: 'mailbox-list'.w(),
// delegate: 'OI*mailboxesController',
contentValueKey: 'name',
contentUnreadCountKey: 'unreadCount',
contentBinding: 'OI*mailboxesController.arrangedObjects',
selectionBinding: 'OI*mailboxesController.selection',
selectOnMouseDown: YES,
acceptsFirstResponder: YES,
@erichocean
erichocean / cocoa_sc.m
Created January 19, 2011 00:24
SproutCore-style page definition in Cocoa with Core Animation layers.
//
// MainWindow.objc
// PhotoBooth
//
// Copyright 2008 Erich Atlas Ocean. All rights reserved.
//
sc_require( "PhotoBooth" );
@synchronized( PB ) {
fooBinding: 'MyApp.controller.name',
barBinding: 'MyApp.aryController.length',
value: function() {
return "The array named %@ has length %@".fmt(this.get('foo'), this.get('bar'));
}.property('foo', 'bar').cacheable()
valueBinding: SC.Binding.transform(function(value, binding) {
return "how many: %@" .fmt(value);
}).from('MyApp.arrayController.length')
@erichocean
erichocean / dag_query.js
Created January 17, 2011 20:33
How to create a DAG of nested queries
var query1 = SC.Query.create( /** omitted */ );
var query2 = SC.Query.create( /** omitted */ );
var joinQuery = SC.Query.create(
// omitted
).from(query1, query2);