Skip to content

Instantly share code, notes, and snippets.

View dmccreary's full-sized avatar

Dan McCreary dmccreary

View GitHub Profile
@dmccreary
dmccreary / xforms-css-layout-vertical-horizontal-grid.xml
Created February 11, 2014 01:22
XForms CSS Layout Examples: Vertical, Horizontal and Grid
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<head>
<title>XForms CSS Layout Examples - Vertical, Horizontal and Grid Layouts</title>
<xf:model>
<xf:instance xmlns="">
<data>
<first-name>Sue</first-name>
<last-name>Johnson</last-name>
<city>Minneapols</city>
<state>MN</state>
@dmccreary
dmccreary / xforms-css-label-layout.xml
Last active August 29, 2015 13:56
XForms CSS to control label layout style: top, left align and right align
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<head>
<title>XForms Label Layout Styles</title>
<xf:model>
<xf:instance xmlns="">
<data>
<first-name>Sue</first-name>
<last-name>Johnson</last-name>
<city>Minneapols</city>
<state>MN</state>
@dmccreary
dmccreary / xforms-css-display-borders.xml
Created February 11, 2014 03:09
XForms CSS example of turning on element borders to see box model for each page region.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<head>
<title>XForms CSS Wireframe with Visible Borders</title>
<xf:model>
<xf:instance xmlns="">
<data>
<myNumber1></myNumber1>
<myNumber2>abc</myNumber2>
<myNumber3>-1</myNumber3>
<myNumber4>101</myNumber4>
@dmccreary
dmccreary / xforms-css-required-fields.xml
Created February 11, 2014 05:23
XForms CSS for styling required fields using three types of label layout styles: top, left and right.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<head>
<title>XForms Minimal Template</title>
<xf:model>
<xf:instance xmlns="">
<data>
<first-name>Sue</first-name>
<middle-name></middle-name>
<last-name>Johnson</last-name>
<phone></phone>
@dmccreary
dmccreary / xforms-css-decimal-right-aligned.xml
Created February 12, 2014 22:28
XForms CSS for right alignment of decimal values
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<head>
<title>XForms Label Layout Styles</title>
<xf:model>
<xf:instance xmlns="">
<data>
<inputs>
<amount1>123</amount1>
<amount2>456</amount2>
<amount3>789</amount3>
@dmccreary
dmccreary / column-label-hidden-in-control.xml
Created May 6, 2014 20:02
Orbeon column label hidden within control working with multiple alerts and error summay
<html xmlns="http://www.w3.org/1999/xhtml" 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" xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>XForms demo of label within table headers</title>
<xf:model>
<xf:instance xmlns="" id="save-data">
<data>
<row>
<integer1>1</integer1>
<integer2>2</integer2>
<integer3>3</integer3>
@dmccreary
dmccreary / disable-save-when-not-dirty-or-invalid.xml
Last active August 29, 2015 14:01
Example Orbeon form for disable Save when not dirty or invalid. Depends on the Orbeon error-summary control.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://orbeon.org/oxf/xml/formatting"
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" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:widget="http://orbeon.org/oxf/xml/widget">
<head>
<!-- fr:error-summary has errors-count-ref which can store number of errors to data. You can use that data to enable button. -->
<title>Example of Visit All Failing</title>
<style type="text/css">
.orbeon .xforms-control {display:block; padding:5px;}
/* not needed in a table display:inline-block; width:10ex; text-align:right; */
.orbeon .xforms-label {font-weight:bold!important; display:inline-block; margin-right: 1ex;}
@dmccreary
dmccreary / ping-led-modulo
Created September 2, 2014 02:22
Display the color of an LED strip based on the modulo of the distance
#include <Adafruit_NeoPixel.h>
// Sample code for using a breadboard Arduino to drive WS2812B LED strip with Adafruit NeoPixel library
// I got mine on e-bay:
// http://www.ebay.com/itm/181268207260?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
// Note - colors for data and ground vary
// I used a 16MHZ Crystal Oscilator
#define PIN 12 // connect the Data In pin
const int pingPin = 7;
int pixelToSet = 1;
@dmccreary
dmccreary / rotary-encoder-led-strip.c
Created October 2, 2014 20:06
Arduino program to drive a 12 pixel LED strip with a rotary encoder.
#include <Adafruit_NeoPixel.h>
/* Rotary encoder read example
http://www.circuitsathome.com/mcu/programming/reading-rotary-encoder-on-arduino
connect the center wire to ground. Connect the side pins to Analog ports */
#define ENC_A 14 // Analog pin A0
#define ENC_B 15 // Analog pin A1
#define ENC_PORT PINC
#define LEDPIN 9 // connect the Data In pin
@dmccreary
dmccreary / rainbow_controller.cpp
Created October 18, 2014 18:50
NeoPixel Controller for Spark
// This #include statement was automatically added by the Spark IDE.
#include "lib1.h"
// This #include statement was automatically added by the Spark IDE.
#include "neopixel/neopixel.h"
#include "application.h"
//#include "spark_disable_wlan.h" // For faster local debugging only
#include "neopixel/neopixel.h"