Skip to content

Instantly share code, notes, and snippets.

@tim-evans
tim-evans / post-commit.sh
Created January 27, 2011 19:41
post-commit for committing docs
#!/bin/sh
#
# Deploys documentation
getGitBranchName()
{
branch="$(git symbolic-ref HEAD 2>/dev/null)" ||
"$(git describe --contains --all HEAD)"
echo ${branch##refs/heads/}
}
@tim-evans
tim-evans / many_attribute.js
Created January 31, 2011 16:21
Addition to Many Attribute test to check that inheritance is actually working
test("inheritance is taken into account for related records", function () {
MyApp.Family = SC.Record.extend({
people: SC.Record.toMany('MyApp.Person', {
inverse: 'family',
isMaster: NO
})
});
MyApp.Person = SC.Record.extend({
family: SC.Record.toOne('MyApp.Family', {
@tim-evans
tim-evans / login_pane.js
Created February 23, 2011 17:52
Login pane
// ==========================================================================
// Project: MO - loginPage
// Copyright: ©2010 Junction Networks
// ==========================================================================
/*globals MO */
// This page describes the main user interface for your application.
MO.loginPane = SC.Pane.create({
layout: { top: 0, bottom: 0, left: 0, right: 0 },
childViews: 'contentView'.w(),
@tim-evans
tim-evans / date_attribute_test.js
Created March 3, 2011 21:43
Test for SC.RecordAttribute Date transform
MyApp = window.MyApp = {};
MyApp.store = SC.Store.create();
MyApp.Message = SC.Record.extend({
init: function () {
this.normalize();
return sc_super();
},
to: SC.Record.attr(String),
@tim-evans
tim-evans / data_source.js
Created March 28, 2011 15:53
foo data source
MyApp.DataSource = SC.DataSource.extend({
fetch: function (store, query) {
var recordType = query.recordType,
guid = SC.guidFor(recordType);
if (guid === SC.guidFor(MyApp.FooRecord)) {
// handle Foo records here
return YES;
} else if (guid === SC.guidFor(MyApp.BarRecord)) {
@tim-evans
tim-evans / statechart_bug.js
Created April 12, 2011 03:28
Bug with 'firstCurrentState'
var MyApp = window.MyApp = SC.Object.create();
MyApp.mixin(SC.StatechartManager, {
trace: YES,
initialState: 'stateA',
stateA: SC.State.design({
substatesAreConcurrent: YES,
stateC: SC.State.design({
initialSubstate: 'stateD',
@tim-evans
tim-evans / gist:948667
Created April 29, 2011 17:34
relationships.js
MyApp.Person = SC.Record.extend({
name: SC.Record.attr(String),
family: SC.Record.toOne(MyApp.Family,
inverse: 'people',
isMaster: YES
})
});
MyApp.Family = SC.Record.extend({
name: SC.Record.attr(String),
@tim-evans
tim-evans / scrolling.diff
Created May 9, 2011 19:13
SC scroll events Cappuccino style
diff --git a/frameworks/core_foundation/resources/core.css b/frameworks/core_foundation/resources/core.css
index 821d88c..3aca696 100644
--- a/frameworks/core_foundation/resources/core.css
+++ b/frameworks/core_foundation/resources/core.css
@@ -6,6 +6,17 @@
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
+#sc-scroller {
+ position: absolute;
@tim-evans
tim-evans / container_bug.js
Created June 3, 2011 13:23
SC.ContainerView bug
MyApp = {};
MyApp.ContainerView = SC.ContainerView.extend({
nowShowing: 'MyApp.GreetingView',
init: function () {
var ret = arguments.callee.base.apply(this, arguments);
// I need this line ------------.
// to have `nowShowing` update v
// this.notifyPropertyChange('nowShowing');
@tim-evans
tim-evans / binding_bug.js
Created July 1, 2011 15:16
Binding bug??
MO.SelectableListItemView = SC.View.extend(
/** @scope MO.SelectableListItemView.prototype */{
/**
@type SC.Hash
@default { bottom: 1 }
@see SC.View#border
*/
border: { bottom: 1 },