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 / changeset.json
Created April 3, 2011 00:04
A standardized JSON changeset format for SproutCore.
// Changeset v2 format
{
"sc_version": 2, // I guess we should start versioning if I'm going to change it ;)
"sc_types": ["Foo", "Bar"],
// TODO: Should we include Namespace information as well?
"Foo": {
"created": [
"<primaryKey>"
// ... more created record ids of type "Foo"
],
@erichocean
erichocean / behavior.js
Created February 4, 2011 01:07
Implementing render-less behaviors with CSS class as link to DOM
/*globals SC MyApp */
// Default CSS animations are defined in CSS files for these properties
MyApp.MyBehavior = SC.Behavior.extend({
target: 'MyApp',
action: 'doSomething',
initialHandler: 'mouseUpNotOver',
BasicApp.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
contentView: SC.CoreView.design({
tagName: 'h1'
classNames: 'amber-label',
render: function(context) {
context.push("Hello world");
}
//
// Define our model class.
//
MyApp.Task = SC.Object.extend({
toJSON: function() {
var hash = {}, key, val;
for (key in this) {
if (!this.hasOwnProperty(key)) continue ;
@erichocean
erichocean / sproutcore-theme-1.4.4-min.css
Created February 2, 2011 02:46
SproutCore 1.4.4 Theme CSS, minified, in a single file.
.sc-theme .sc-button-view{text-decoration:none;border:none;padding:0;}.sc-theme .sc-button-view.icon img.icon{position:relative;vertical-align:middle;top:-2px;margin-right:2px;height:16px;width:16px;}
.sc-theme .sc-button-view.sc-regular-size.square{text-shadow:#fff 0 1px 0;color:black;}
.sc-theme .sc-button-view.sc-regular-size.square .sc-button-inner{display:block;}
.sc-theme .sc-button-view.sc-regular-size.square .sc-button-label{display:block;text-align:center;padding:0 0 7px 0;}
.sc-theme .sc-button-view.sc-regular-size.square.active .sc-button-label{text-shadow:black 0 -1px 0;color:white;}
.sc-theme .sc-button-view.square.disabled .sc-button-label{color:#999;text-shadow:none;}
.sc-theme .sc-button-view.sc-regular-size.square.def .sc-button-label,.sc-theme .sc-button-view.sc-regular-size.square.sel .sc-button-label{color:white;text-shadow:#2a569e 0 -1px 0;}
.sc-theme .sc-button-view.sc-regular-size.square.def.disabled .sc-button-label,.sc-theme .sc-button-view.sc-regular-size.square.sel.disabled .sc-butt
@erichocean
erichocean / sproutcore-min-1.4.4.css
Created February 2, 2011 02:43
SproutCore 1.4.4 CSS, minified, in a single file.
.sc-button-view.sc-static-layout{margin:0 4px;}.sc-button-view{display:inline-block;vertical-align:middle;text-decoration:none;border:1px #555 solid;border-radius:3px;-moz-border-radius:3px;}
.sc-button-view .sc-button-inner{position:relative;display:block;height:100%;text-align:center;}
.sc-button-view label{position:relative;display:block;line-height:21px;text-align:center;}
.sc-button-view img{vertical-align:middle;margin-right:2px;position:relative;top:-2px;left:-2px;}
.ie7 .sc-button-view{display:inline;}.sc-view{font-family:"Lucida Sans","Lucida Grande",Verdana,Arial,sans-serif;font-size:12px;line-height:1.4;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);}
.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;-ms-text-overflow:ellipsis;}
body{position:absolute;margin:0;top:0;bottom:0;left:0;right:0;}.sc-view body,.sc-view div,.sc-view dl,.sc-view dt,.sc-view dd,.sc-view ul,.sc-view ol,.sc-view li,.sc-view h1,.sc-view h2,.sc-view h3,.sc-view h
@erichocean
erichocean / index.html
Created February 2, 2011 02:42
Default index.html for a SproutCore application.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="apple-touch-icon" href="images/sproutcore-logo.png" />
@erichocean
erichocean / sproutcore-min.js
Created February 2, 2011 02:36
SproutCore 1.4.4, minified, in a single file.
/* @license
==========================================================================
SproutCore Costello -- Property Observing Library
Copyright ©2006-2010, Sprout Systems, Inc. and contributors.
Portions copyright ©2008-2010 Apple Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
@erichocean
erichocean / core_actions.js
Created January 29, 2011 03:59
Where to put actions...
SC.mixin(YourAppNamespace, { // YourAppNamespaces is defined in core.js
yourAction: function() {
// goes here
}
});
/** @private
Handle space key event. Do action
*/
insertText: function(chr, evt) {
if (chr === ' ') {
var sel = this.get('selection');
if (sel && sel.get('length')>0) {
this.invokeLater(this._cv_action, 0, null, evt);
}
return YES ;