Skip to content

Instantly share code, notes, and snippets.

@avernet
avernet / gist:4692948
Created February 1, 2013 18:02
xforms-model.xpl A pipeline to run arbitrary XForms code on the server
<!--
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:3975134
Created October 29, 2012 17:42
iPhone 5 vs. Nexus 4: The Specs

iPhone 5 vs. Nexus 4: The Specs

iPhone5 Nexus 4
Price for 16 GB $700 $350
RAM 1 GB 2 GB
CPU 1.3 GHz dual core 1.5GHz quad-core
Display size 4in 4.7in
Display resolution 1136x640 1280x768
Display PPI 326 320
@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
@igstan
igstan / state-monad.coffee
Created April 22, 2011 11:57
State Monad in CoffeeScript
push = (element) -> (stack) ->
newStack = [element].concat stack
{value: element, stack: newStack}
pop = (stack) ->
element = stack[0]
newStack = stack.slice 1
{value: element, stack: newStack}
bind = (stackOperation, continuation) -> (stack) ->
@ebruchez
ebruchez / CoffeeScript with jQuery.coffee
Created January 21, 2011 19:34
XForms action in XML syntax and with tentative CoffeeScript syntax
instance = model.instances['fr-persistence-instance']
resources = x.models['fr-resources-model'].vars['$fr-fr-resources']
$('error', instance).replaceWith event.response-body
$('is-error', instance).replaceWith 'true'
x.message 'Error with submission: ' + event.submission-id, 'xxf:log-debug'
x.message event.response-body, 'xxf:log-debug'
switch event['error-type']
@avernet
avernet / README.md
Created January 18, 2011 23:38
Bookmarklet detecting if a page uses automatically generated ids

Bookmarklet detecting if a page uses automatically generated ids

Purpose

When producing HTML markup from XForms, Orbeon Forms automatically generates ids if your XForms doesn't contain ids. If you reload the same page twice, the ids produced by Orbeon Forms will be the same. However, if you upgrade to a newer version of Orbeon Forms, those ids could be different, which might be an issue for you if you have automated tests that depend on those ids. You can avoid this issue by making sure you always specify ids in your XForms, and this bookmarklet helps you to check that a given page doesn't contain any automatically generated id.

@ndw
ndw / utftest.pl
Created September 29, 2010 17:08
Simple Perl script to find UTF8 encoding errors in documents
#!/usr/bin/perl -- # -*- Perl -*-
use strict;
use Encode qw/encode decode/;
my $file = shift @ARGV || "-";
my $count = 0;
open (F, $file);
while (<F>) {