Skip to content

Instantly share code, notes, and snippets.

@ozeebee
ozeebee / EditableObj.ko.coffee
Created January 14, 2014 16:31
A generic JavaScript class that takes a plain js object and transforms it into a KnockoutJS object with support for editing (commit/reset/isDirty). Based on the work of Ryan Niemeyer : http://www.knockmeout.net/2013/01/simple-editor-pattern-knockout-js.html. Written in CoffeeScript, uses ko.mapping plugin
class EditableObj
constructor: (jsonData) ->
@hidden = -> # empty function where we will add properties that won't be exported with ko.toJS/ko.mapping.toJS
@update(jsonData)
update: (data) ->
console.log "*** update data=", data
# let ko.mapping create observable properties from the existing ones
ko.mapping.fromJS(data, {}, this)
@hidden.savedData = data
reset: ->
@ozeebee
ozeebee / bigsourcecodebug.adoc
Created July 23, 2014 16:15
asciidoctor-pdf reproducer for the big code block problem

Reproducer for the big source code block problem

The Problem

Here is a big source code block that spans over multiple (PDF) pages, the background 'panel' (or well, or whatever you call it) looks bad…​

A very long code block (too long to fit a single page)
line 1
@ozeebee
ozeebee / test_DocGist.adoc
Last active July 20, 2016 08:45
A DocGist (asciidoctor) test file.

Test DocGist

Common DocGist, let me edit this file !

File edited

right now