Skip to content

Instantly share code, notes, and snippets.

dc.ui.Dialog = dc.View.extend({
className : 'dialog',
callbacks : [
['.cancel', 'click', 'cancel'],
['.ok', 'click', 'confirm']
],
constructor : function(options) {
updateNavigation : function(sections) {
DV.Schema.data.chapters = [];
_.each(sections, function(sec) {
sec.id = _.uniqueId();
sec.pages = '' + sec.start_page + '-' + sec.end_page;
_.each(_.range(sec.start_page-1, sec.end_page), function(i){
DV.Schema.data.chapters[i] = sec.id;
});
});
DV.controller.models.chapters.chapters = DV.Schema.data.chapters;
(function(){
var square = function(x) {
return (x * x);
};
var sum = function(x, y) {
return (x + y);
};
var odd = function(x) {
return ((x % 2) === 0);
};
# TODO: Think of a name for this crazy thing.
# Functions:
square: x => x * x.
sum: x, y => x + y.
odd: x => x % 2 is 0.
even: x => x % 2 aint 0.
// Handles JavaScript history management and callbacks. To use, register a
// regexp that matches the history hash with its corresponding callback:
//
// dc.history.register(/^#search/, controller.runSearch);
//
// And then you can save arbitrary history fragments.
//
// dc.history.save('search/freedom/p3');
//
DV.history = {
$.fn.extend({
draggable : function() {
this.each(function() {
var drag = _.bind(function(e) {
e.stopPropagation() && e.preventDefault();
this.style.left = this._drag.left + event.pageX - this._drag.x + 'px';
this.style.top = this._drag.top + event.pageY - this._drag.y + 'px';
}, this);
// Handles JavaScript history management and callbacks. To use, register a
// regexp that matches the history hash with its corresponding callback:
//
// dc.history.register(/^#search/, controller.runSearch);
//
// And then you can save arbitrary history fragments.
//
// dc.history.save('search/freedom/p3');
//
DV.history = {
START_COORDS = [500, 500]
def setup
size 500, 500
no_fill
smooth
color_mode HSB, 255
@stop = false
@step_counter = 0
@dj = DeJongAttractor.new
$.fn.extend({
// When the next click or keypress happens, anywhere on the screen, hide the
// element. 'clickable' makes the element and its contents clickable without
// hiding. The 'onHide' callback runs when the hide fires, and has a chance
// to cancel it.
autohide : function(options) {
var me = this;
options = _.extend({clickable : null, onHide : null}, options || {});
me._autoignore = true;
require 'strscan'
module DC
module Import
# Supported formats:
#
# 10/13/2009 (10-13-2009)
# 10/13/09 (10-13-09)
# 2009/10/13 (2009-10-13)