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
| <?php | |
| header('Content-Type: text/event-stream'); | |
| header('Cache-Control: no-cache'); | |
| header('Connection: keep-alive'); | |
| header('X-Accel-Buffering: no'); // Disable nginx buffering | |
| // Prevent timeout | |
| set_time_limit(0); | |
| ini_set('max_execution_time', 0); |
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.json.JsonGenerator | |
| import groovy.json.StreamingJsonBuilder | |
| def data = [name: "Café", message: "Hello"] | |
| def generator = new JsonGenerator.Options() | |
| .disableUnicodeEscaping() | |
| .build() | |
| def stringWriter = new StringWriter() |
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' |
NewerOlder