This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var render = function(param1, param2, param3, model) | |
{ | |
// process model and generate dom to display it | |
// sample code to display a select with key/value from model | |
_select = document.getElementById(param1); | |
for (key in model) | |
{ | |
option = document.createElement("option"); | |
option.value = key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat | |
import java.text.ParseException | |
TimeZone.setDefault(TimeZone.getTimeZone("UTC")) | |
// casos: con o sin fraccion, con o sin timezone | |
def candidates = ['1981-10-24T09:59:00', | |
'1981-10-24T09:59:00Z', | |
'1981-10-24T09:59:00-03:00', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.xml.datatype.*; | |
Duration dur = DatatypeFactory.newInstance().newDuration("PT5H12M36S"); | |
println dur.getHours() | |
println dur.getMinutes() | |
println dur.getSeconds() | |
println dur | |
println dur.getHours()*60*60 + dur.getMinutes()*60 + dur.getSeconds() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.util.XmlSlurper | |
def xml = new XmlSlurper().parseText(''' | |
<issues> | |
<issue> | |
<id>1</id> | |
<priority>1</priority> | |
</issue> | |
<issue> | |
<id>2</id> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//def matcher = ('groovy' ==~ /\w.*/) | |
//assert matcher instanceof Boolean | |
def terms = ['EMR', 'EMR.2', 'EMR 2', 'EMR-2', 'EMR.SYSTEM.ID', '<>'] | |
terms.each { | |
if (it ==~ /[^\s]*/) | |
{ | |
println "SI: "+ it | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BinaryTree { | |
def tmp // temporal expression | |
def value | |
def left | |
def right | |
def parent // null for root | |
String toString() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import com.pi4j.io.i2c.I2CBus; | |
import com.pi4j.io.i2c.I2CDevice; | |
import com.pi4j.io.i2c.I2CFactory; | |
import com.pi4j.io.i2c.I2CFactory.UnsupportedBusNumberException; | |
import com.pi4j.platform.PlatformAlreadyAssignedException; | |
import com.pi4j.util.Console; | |
public class I2CScanner { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.Callable; | |
import com.pi4j.io.gpio.GpioController; | |
import com.pi4j.io.gpio.GpioFactory; | |
import com.pi4j.io.gpio.GpioPinDigitalInput; | |
import com.pi4j.io.gpio.GpioPinDigitalOutput; | |
import com.pi4j.io.gpio.PinPullResistance; | |
import com.pi4j.io.gpio.PinState; | |
import com.pi4j.io.gpio.RaspiPin; | |
import com.pi4j.io.gpio.trigger.GpioCallbackTrigger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def root = new XmlSlurper().parseText("""<root> | |
<context> | |
<start_time> | |
<value>[[COMPOSITION_DATE:::DATETIME]]</value> | |
</start_time> | |
<setting> | |
<value>[[COMPOSITION_SETTING_VALUE:::STRING]]</value> | |
<defining_code> | |
<terminology_id> | |
<value>openehr</value> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def uuids = ['a4c0064a-74fc-41e2-a5e0-0492ed2d79a7', '', 'fdgsfgsg', '345'] | |
uuids.each { | |
def matcher = (it ==~ /([a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})/) | |
if (matcher) println it + " OK" | |
else println it + " NO" | |
} |