This file contains 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 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%' |
This file contains 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 | |
function snakeToCamelCase(string $input): string | |
{ | |
return ucfirst(str_replace('_', '', ucwords(strtolower($input), '_'))); | |
} | |
function getClassNameRecursive($string, $start, $end) | |
{ |
This file contains 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
// Formats to comply with https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified | |
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); | |
format.setTimeZone(TimeZone.getTimeZone("GMT")); | |
println format.format(new Date()) |
This file contains 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
function $co(key, value) { if (arguments.length == 1) { return connectorMap.get(key); } else { return connectorMap.put(key, value); } } | |
function $c(key, value) { if (arguments.length == 1) { return channelMap.get(key); } else { return channelMap.put(key, value); } } | |
function $s(key, value) { if (arguments.length == 1) { return sourceMap.get(key); } else { return sourceMap.put(key, value); } } | |
function $gc(key, value) { if (arguments.length == 1) { return globalChannelMap.get(key); } else { return globalChannelMap.put(key, value); } } | |
function $g(key, value) { if (arguments.length == 1) { return globalMap.get(key); } else { return globalMap.put(key, value); } } | |
function $cfg(key, value) { if (arguments.length == 1) { return configurationMap.get(key); } else { return configurationMap.put(key, value); } } | |
function $r(key, value) { if (arguments.length == 1) { return responseMap.get(key); } else { return responseMap.put(key, value); } } | |
function $(string) { | |
try { if(responseMap.containsKey(string)) { return |
This file contains 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 s = "An EHR_STATUS resource needs to be always created and committed in the new EHR. This resource MAY be also supplied by the client as the request body. If not supplied, a default EHR_STATUS will be used by the service with following attributes" | |
def ss = s.split(" ") | |
println ss | |
def wlimit = 4 | |
def climit = 23 | |
This file contains 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
function formatHL7String(str) | |
{ | |
var hl7String = str.replace(/\\/g, '\\E\\'); | |
hl7String = hl7String.replace(/\|/g, '\\F\\'); | |
hl7String = hl7String.replace(/\^/g, '\\S\\'); | |
hl7String = hl7String.replace(/~/g, '\\R\\'); | |
hl7String = hl7String.replace(/&/g, '\\T\\'); | |
return hl7String; | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --> | |
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'"> | |
<link href="./styles.css" rel="stylesheet"> | |
<title>Hello World!</title> | |
</head> | |
<body> |
This file contains 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
// 14 March 2019 | |
// Updated Number().toFixed() polyfill to add-then-remove the trailing '1' in every case. | |
// see original at https://gist.github.com/dfkaye/e977af36e668aa134c0ce55bab5bb15f | |
// and at https://dfkaye.wordpress.com/2017/12/06/number-tofixed-rounding-errors-broken-but-fixable/ | |
/* | |
// fixes blog post solution | |
;(1.005).toFixed(2) == "1.01" || (function(prototype) { | |
var toFixed = prototype.toFixed |
This file contains 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
/* | |
Copy from: http://web.archive.org/web/20090617110918/http://www.openasthra.com/c-tidbits/printing-binary-trees-in-ascii/ | |
Source: http://web.archive.org/web/20071224095835/http://www.openasthra.com:80/wp-content/uploads/2007/12/binary_trees1.c | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
NewerOlder