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
| // Here Groovy prints the '$', leaving it for the JS to evaluate the variable correctly on the client side. | |
| let btnAuthorize = `<a href="merge/${'$'}{record.id}/authorize" class="btn btn-primary">Authorize</a>`; | |
| // This will fail if record is a JS object | |
| let btnAuthorize = `<a href="merge/${record.id}/authorize" class="btn btn-primary">Authorize</a>`; |
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
| //ehrs = ['A', 'B', 'C', 'D', 'E', 'F'] | |
| // TODO: the canonical should be initialized with the identities: A: A, ... so when asking for the canonical of an unmerged EHR, it gives the same EHR back | |
| canonical = [:] | |
| history = [] | |
| // A => B : [A: B] | |
| // C => B : [C: B, A: B] | |
| // B => E : [C: E, A: E, B: E] | |
| // merge secondaryEhr into primaryEhr |
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
| # Find big files | |
| find / -type f -size +500M -ls | |
| # Monitor file changes in folder | |
| inotifywait -e modify,delete,move -m -r logs |
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
| SELECT | |
| TABLE_SCHEMA, | |
| TABLE_NAME, | |
| COLUMN_NAME, | |
| DATA_TYPE | |
| FROM | |
| INFORMATION_SCHEMA.COLUMNS | |
| WHERE | |
| DATA_TYPE = 'datetime' AND TABLE_SCHEMA = 'atomik' | |
| ORDER BY |
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
| Patient fhirPatient = ... | |
| for (HumanName name : fhirPatient.getName()) | |
| { | |
| // family names with extensions | |
| StringType familyElement = name.getFamilyElement(); | |
| if (familyElement != null) { | |
| System.out.println("Family: " + familyElement.getValue()); | |
| for (Extension ext : familyElement.getExtension()) { | |
| System.out.println(" Family Extension: " + ext.getUrl() + " = " + ext.getValue()); |
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
| // define the url | |
| def url = "http://news.google.com/news?ned=us&topic=h&output=rss" | |
| def rss = new XmlSlurper().parse(url) | |
| println rss.channel.title | |
| rss.channel.item.each { | |
| println "- ${it.title}" | |
| } |
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
| // Convierte un documento XML a un string XML | |
| // http://stackoverflow.com/questions/6507293/convert-xml-to-string-with-jquery | |
| function xmlToString(xmlData) { | |
| var xmlString; | |
| //IE | |
| if (window.ActiveXObject) { | |
| xmlString = xmlData.xml; | |
| } | |
| // code for Mozilla, Firefox, Opera, etc. |
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 subjectUid = '...' | |
| if (!(subjectUid ==~ /([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})/)) | |
| { | |
| return 'error' | |
| } | |
| return 'ok' |
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
| // CSV is simple means it doesn't include commas so there is no value separator like " inside the CSV | |
| // Though we take into account there could be spaces after the commas and before the values, and those are removed | |
| // Though the spaces after the values are not removed so "a , b" would be parsed as ["a ", "b"] | |
| def b = "a, b b, c c c" | |
| b = b.replaceAll(",( )*", ",") | |
| println b |
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 a = ["a", "b", "c"] | |
| "value LIKE "+ a.collect {"'%"+ it + "%'"}.join(" OR value LIKE ") | |
| // value LIKE '%a%' OR value LIKE '%b%' OR value LIKE '%c%' |
NewerOlder