Skip to content

Instantly share code, notes, and snippets.

@ialexi
ialexi / core.js
Created October 16, 2009 13:58
Provides CSS Transition-style Animation for SproutCore—even if the browser doesn't support CSS Transitions.
// ==========================================================================
// Project: Animate
// Copyright: ©2009 Alex Iskander
// Now in fancy GitHub repository: http://github.com/ialexi/animate
// ==========================================================================
/*globals Animate */
/** @namespace
A simple mixin called Animatable is provided. What does it do?
It makes CSS transitions for you, and if they aren't available,
myForm: SC.FormView.design({
layout: { top: 0, left: 0, right: 0, bottom: 40 },
rows: 'name gender'.w(),
contentBinding: "MyApp.fooController",
// if row gets a class as a first argument, it conveniently sets up a structure
// like the following, but with only one field.
name: SC.FormView.row({
fields: "firstName lastName".w(),
fieldLabel: "Name:",
didUpdateLayer: function()
{
sc_super();
var layer = this.get("layer");
if (!layer) return;
var ows = layer.style.whiteSpace, opos = layer.style.position, ow = layer.style.width,
oh = layer.style.height;
// ==========================================================================
// Project: RsvpClient.RsvpDataSource
// Copyright: ©2009 My Company, Inc.
// ==========================================================================
/*globals RsvpClient */
sc_require("models/contact");
RsvpClient.SORT_PRIORITY = "isAttending DESC,hasResponded DESC,hasVisited DESC,lastName,firstName";
{
"repeat": "x",
"repeat-width": 32
}
config_path = os.path.join(set_path, "config.json")
if os.path.exists(config_path):
try:
print "About to open file"
config_file = open(config_path)
print "About to read file"
config_content = config_file.read()
print "File content: "
print config_content
config.update(json.loads(config_content))
def raw(self):
struct = {
"guid": self.pk,
"firstName": self.firstName,
"lastName": self.lastName,
"addressAs": self.addressAs,
"email": self.email,
"isAttending": self.isAttending,
"isBringingGuest": self.bringingGuest,
"guestName": self.guestName,
_hashFor: function(target, action) {
var hash = SC.guidFor(target);
if (SC.typeOf(action) == SC.T_STRING) {
hash += "::" + action;
} else hash += SC.guidFor(action);
return hash;
},
// ==========================================================================
// Project: RsvpClient.contactsFilterController
// Copyright: ©2009 My Company, Inc.
// ==========================================================================
/*globals RsvpClient */
/** @class
@extends SC.Object
*/
import urllib, urllib2
HOST = "localhost"
PORT = 8003
class CorneliusError: pass
def update(path, message):
global HOST, PORT
result = urllib2.urlopen("http://" + HOST + ":" + str(PORT) + "/" + urllib.quote(path + ";" + message))
res = result.read()