- http://json-schema.org/
- Describes/defines a JSON document
- Very popular and well-tooled, lots of validators in many different languages.
- Great for describing/defining/validating JSON responses, request payloads, etc.
- JSON schema is JSON, so human-readability is mediocre.
- Spec is obtuse.
- Tutorial: https://spacetelescope.github.io/understanding-json-schema/
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
INSERT INTO reports (reference, program_id, generation_time, version) | |
SELECT | |
i.reference | |
programs.id AS program_id, | |
nullif(i.generation_time, '')::timestamp AS generation_time, | |
nullif(i.version, '')::numeric AS version, | |
-- etc | |
FROM imported_reports i | |
JOIN programs ON programs.reference = i.program_reference | |
ON CONFLICT (external_id) DO UPDATE SET |
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
-- Load projects from import | |
-- | |
INSERT INTO projects (reference, name, created_at, updated_at) | |
SELECT | |
i.project_reference AS reference, | |
i.project_name AS name | |
now() AS created_at, | |
now() AS updated_at | |
FROM (SELECT DISTINCT project_reference, project_name FROM imported_reports) i | |
ON CONFLICT (reference) DO UPDATE SET |
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 data | |
-- | |
COPY imported_reports | |
FROM '/tmp/large-enterprise-export.csv' | |
WITH (format csv, header) | |
; |
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
-- Create table to hold raw imported data | |
-- | |
DROP TABLE IF EXISTS imported_reports; | |
CREATE TABLE imported_reports ( | |
reference varchar primary key, | |
project_reference varchar, | |
project_name varchar, | |
version varchar, | |
generation_time varchar, | |
-- 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
-- Queries a table like this: | |
-- | |
-- id settings updated_at | |
-- 10013 {"reports.url_expiry":400} 2018-04-30 00:00:00 | |
-- 10014 {"setting2":"foo"} 2018-05-01 00:00:00 | |
-- 10015 {"reports.url_expiry":200} 2018-05-02 00:00:00 | |
-- | |
-- to roll up the settings column into: | |
-- | |
-- { "reports.url_expiry" : 200, "setting2" : "foo" } |
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
commit 918bc5d3a8323885e014fdb9f821503062692a90 | |
Author: Daniel Fone <[email protected]> | |
Date: Sat Jul 22 14:30:53 2017 +1200 | |
Add coverage requirements | |
diff --git a/coverage/.last_run.json b/coverage/.last_run.json | |
new file mode 100644 | |
index 0000000..2f8e4cc | |
--- /dev/null |
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
class ActiveJobLog < ApplicationRecord | |
enum status: { | |
queued: 'queued', | |
working: 'working', | |
finished: 'finished', | |
failed: 'failed', | |
} | |
def active? |
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
render () { | |
return ( | |
<div class="clearfix"> | |
{/* = render 'inventories/show/quick_add_form' if policy(:campaign).new? */} | |
{/* = render 'inventories/show/table_legend' */} | |
</div> | |
{/* - | |
period_width = 5 | |
panel_width = 23 |
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
public class HelloWorld2 { | |
public static Integer doubleNum(Integer x) { | |
String answer2 = 'danswer.answer2' + '\n'; | |
Boolean isPrime; | |
isPrime = x / 3 == 0; // Note: Not really prime. | |
if ( isPrime ) { | |
return 0; | |
} else { | |
return x*2; | |
} |