Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript"
src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.7.js'></script>
<script type="text/coffeescript">
$('input').on "change blur", (event) ->
console.log event.type, event.target.id
@avernet
avernet / gist:1504192
Created December 21, 2011 01:51
Function index uses repeat id 'outer-repeat' which is not in scope
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
@avernet
avernet / gist:1573960
Created January 7, 2012 06:09
Readonly RTE
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
<xhtml:title>Readonly RTE</xhtml:title>
<xforms:model>
<xforms:instance>
@avernet
avernet / gist:1641954
Created January 19, 2012 19:20
Form Builder layout off-screen rendering
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
Event.onDOMReady(function() {
var layoutElement = ORBEON.util.Dom.get("fb-layout");
var layoutFragment = document.createDocumentFragment();
var fragmentRoot = layoutFragment.ownerDocument.createElement('div');
layoutFragment.appendChild(fragmentRoot);
layoutElement.style.height = YAHOO.util.Dom.getViewportHeight() + "px";
@avernet
avernet / gist:1685838
Created January 26, 2012 23:30
Using event('response-status-code')
<xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
<xhtml:head>
<xforms:model>
<xforms:submission id="inexistent" resource="http://www.orbeon.com/gaga" replace="instance" method="post">
<xforms:message ev:event="xforms-submit-error" level="modal">submission1 error (<xforms:output value="event('response-status-code')"/>)</xforms:message>
</xforms:submission>
<xforms:instance>
<instance/>
</xforms:instance>
</xforms:model>
@avernet
avernet / gist:1685914
Created January 26, 2012 23:50
Copy a section to all the other sections in XForms
<xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
<xhtml:head>
<xforms:model>
<xforms:instance>
<instance>
<rep-section>
<first-name/>
<last-name/>
</rep-section>
<rep-section>
@avernet
avernet / gist:1731817
Created February 3, 2012 19:10
Repeat adding space to class attribute of template when using AVT
<!--
Copyright (C) 2007 Orbeon, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
@avernet
avernet / gist:1775511
Created February 8, 2012 23:40
Union type in Roy
data StringNumber =
TString String | TNumber Number
let show (x: StringNumber) = match x
case (TString s) = console.log s
case (TNumber n) = console.log n
show (TString 'gaga')
@avernet
avernet / gist:1838252
Created February 15, 2012 19:14
data() in XForms
<xhtml:html
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xhtml:head>
<xhtml:title>Typed-value accessor</xhtml:title>
@avernet
avernet / EasternOrder.hs
Created February 18, 2012 01:57
Polymorphism in Haskell
module EasternOrder where
import Serializable
import Person
instance IsSerializable Person where
serialize (Person f l) = l ++ " " ++ f
easternOrder :: Person -> Serializable
easternOrder = Serializable