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 / gist:741440
Created December 15, 2010 00:58
proof-of-concept: allows you to write <key>Update: functions instead of putting all your code inside update()
// Add this to your custom view or render delegate (see comment below for the rest).
update: function(jquery) {
var fn, key, displayProperties = this.getChangedDisplayProperties() ;
for (key in displayProperties) {
if (!displayProperties.hasOwnProperty(key)) continue ;
if (fn = this[key+'Update']) fn.call(this, jquery, displayProperties[key]) ;
}
}
@erichocean
erichocean / gist:673484
Created November 12, 2010 00:09
Coding with Erich's SproutCore-style C application framework.
//
// core_main.c
// FOHR
//
// Created by Erich Ocean on 11/10/10.
// Copyright (c) 2010 Erich Atlas Ocean. All rights reserved.
//
#include "core.h"
#include <string.h> // strcmp
//
// core_main.c
// love
//
// Created by Erich Ocean on 11/10/10.
// Copyright (c) 2010 __MyCompanyName__. All rights reserved.
//
#include "core.h"
#include <Block.h>
typedef void (^myblock)();
myblock[10] makeblocks()
{
__block double foo;
myblock[10] = malloc(sizeof(myblock) * 10);
for (int i = 0; i<10; ++i) {
myblock[i] = Block_copy(^{
foo = foo + 1;
/**
Invokes the callback for each index. Otherwise works just like regular
forEach().
@param {Function} callback
@param {Object} target
@returns {SC.IndexSet} receiver
*/
forEachIndex: function(callback, target) {
var content = this._content,
didUpdateLayer: function() {
var elem = this.$('canvas'),
ctx = elem[0].getContext("2d"),
width = this.$().width(),
height = this.$().height(),
loc = this.get('anchorLocation'),
ploc, color, x, y, tmp;
// adjust size as needed...
if (Number(elem.attr('width')) !== width) elem.attr('width', width);
From 43ed2e9f37751e8ab43a4036186638f19fdcdf7e Mon Sep 17 00:00:00 2001
From: Erich Ocean <[email protected]>
Date: Thu, 12 Aug 2010 15:25:52 -0700
Subject: [PATCH] initial ptex support
---
src/liboslexec/master.cpp | 8 ++++
src/liboslexec/optexture.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++
src/liboslexec/osl_ptex.h | 66 +++++++++++++++++++++++++++++
src/liboslexec/oslexec_pvt.h | 25 +++++++++++
// ==========================================================================
// Project: hub.js - cloud-friendly object graph sync
// Copyright: ©2010 Erich Ocean.
// Portions ©2006-2009 Sprout Systems, Inc. and contributors.
// Portions ©2008-2009 Apple Inc. All rights reserved.
// License: Licensed under an MIT license (see license.js).
// ==========================================================================
/*global hub */
/**
hub.attr = hub.Record.attr ;
hub.toOne = hub.Record.toOne ;
hub.toMany = hub.Record.toMany ;
Created by
----------
In our schema, we'd like to know who created a specific ``Task``. In hub.js,
users are represented as instances of the ``hub.User`` class (or a subclass),
and there is an API call to get the ``hub.User`` that created a particular
record, so we'll create a computed property that calls that::
TaskList.Task = hub.Record.extend({
isDone: hub.attr(Boolean, { default: false }),