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
select decode(replace('45774962-e6f7-41f6-b940-72ef63fa1943'::text, '-', ''), 'hex'); | |
-- And here's how to convert it to the ShortUUID format used in Process Street | |
select replace(encode(substring(decode(replace('45774962-e6f7-41f6-b940-72ef63fa1943'::text, '-', ''), 'hex') from 9 for 8) || | |
substring(decode(replace('45774962-e6f7-41f6-b940-72ef63fa1943'::text, '-', ''), 'hex') from 1 for 8), 'base64'), '=', ''); |
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 (localStorage && !localStorage.getItem('size')) { | |
var i = 0; | |
try { | |
// Test up to 10 MB | |
for (i = 250; i <= 10000; i += 250) { | |
localStorage.setItem('test', new Array((i * 1024) + 1).join('a')); | |
} | |
} catch (e) { | |
localStorage.removeItem('test'); | |
localStorage.setItem('size', i - 250); |
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
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
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
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
<?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
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
def uploadPart(bucket: Bucket, uploadTicket: BucketFileUploadTicket, bucketFilePart: BucketFilePart): Future[BucketFilePartUploadTicket] = { | |
require(bucketFilePart.partNumber > 0, "The partNumber must be greater than 0") | |
require(bucketFilePart.partNumber < 10001, "The partNumber must be lesser than 10001") | |
// A hack way to get access to private httpUrl method | |
val url = bucket.s3.url(bucket.name, uploadTicket.name, 0).split('?')(0) | |
val uploadPart = bucket.s3.awsWithSigner | |
.url(url) | |
.withQueryString( | |
"partNumber" -> bucketFilePart.partNumber.toString, |
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) |
NewerOlder