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
create or replace function uuid_to_muid(id varchar) | |
returns varchar as | |
$$ | |
trim(base64_encode( | |
substring(hex_decode_binary(replace(id, '-', '')), 9, 8) || | |
substring(hex_decode_binary(replace(id, '-', '')), 1, 8), | |
0, | |
'-_ ' | |
)) | |
$$; |
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
templateService.getById(id) match { | |
case Found(template) => ... | |
case NotFound(message) => // message contains a nice (consistent message) | |
} | |
for { | |
checklist <- checklistService.getById(checklistId).toRight("checklist").right | |
template <- templateService.getById(checklist.template.id).toRight | |
} yield { | |
... |
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
==> Detecting CI provider | |
Circle CI Detected | |
==> Preparing upload | |
==> Processing gcov (disable by -X gcov) | |
Executing gcov (find /home/ubuntu/process-street -type f -name '*.gcno' -exec gcov -pb {} +) | |
==> Collecting reports | |
+ /home/ubuntu/process-street/target/scala-2.11/scoverage-data/scoverage.coverage.xml bytes=23057648 | |
+ /home/ubuntu/process-street/target/scala-2.11/coverage-report/cobertura.xml bytes=4840129 | |
+ /home/ubuntu/process-street/target/scala-2.11/scoverage-report/scoverage.xml bytes=11752247 | |
==> Appending adjustments (http://bit.ly/1O4eBpt) |
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 elvis($object, $path = null) { | |
return array_reduce(explode('.', $path), function ($subObject, $segment) { | |
return isset($subObject[$segment]) ? $subObject[$segment] : null; | |
}, $object); | |
} | |
// Example | |
$o = [ 'a' => [ 'b' => 1, 'c' => 2 ], 'd' => 3 ]; |
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
if (!String.prototype.format) { | |
(function() { | |
'use strict'; | |
var TEMPLATE_REGEXP = /\${\s*([$_a-z][$_a-z0-9]*)\s*}/ig; | |
var format = function (env) { | |
return this.replace(TEMPLATE_REGEXP, function (_, expr) { | |
return env[expr]; | |
}); | |
}; |
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 elvis(object, path) { | |
return path ? path.split('.').reduce(function (value, key) { | |
return value && value[key]; | |
}, object) : object; | |
} | |
// Example | |
var o = { a: { b: 1, c: 2 }, d: 3 }; | |
elvis(o, 'a'); | |
// = { b: 1, c: 2 } |
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 serialize(object) { | |
return Object.keys(object).map(function (key) { | |
return encodeURIComponent(key) + '=' + encodeURIComponent(object[key]); | |
}).join('&'); | |
} | |
// Example | |
var params = { | |
username: 'cdmckay', | |
password: 'hunter2' |
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
import play.api.libs.ws.WS | |
import play.api.mvc.MultipartFormData.FilePart | |
import play.api.mvc.MultipartFormData | |
import utilities.MultipartFormDataWriteable._ | |
... | |
val url = "https://example.com" | |
val dataParts = Map( |
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
package utilities | |
import java.io.{ByteArrayOutputStream, File} | |
import com.ning.http.client.FluentCaseInsensitiveStringsMap | |
import com.ning.http.multipart.{MultipartRequestEntity, FilePart, StringPart} | |
import play.api.http.HeaderNames._ | |
import play.api.http.{ContentTypeOf, Writeable} | |
import play.api.mvc.{Codec, MultipartFormData} |
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
<!-- The dueDate field is a UNIX offset of the date --> | |
<input type="text" | |
ng-model="dueDate" | |
ps-datetime-picker | |
class="form-control"> |
NewerOlder