Skip to content

Instantly share code, notes, and snippets.

View kantord's full-sized avatar

Dániel Kántor kantord

View GitHub Profile
@kantord
kantord / dashboard.yml
Last active February 20, 2018 12:32
variables example
dashboard "Food":
- h1 text: Food
- h2 text: By caloric content
- h3 text: "Chart to show"
- dropdown food=Bananas:
- {"value": "Bananas", "text": "Bananas"}
- {"value": "Tofu", "text": "Tofu"}
- {"value": "Peanut butter", "text": "Peanut butter"}
- 3 columns:
- attr:query: '.'
@kantord
kantord / number_of_sovereign_states_by_year.csv
Last active February 25, 2018 12:11
Number of sovereign states by year
year count(*)
1776 147
1820 149
1821 150
1822 154
1823 155
1824 155
1825 156
1826 157
1827 153
year war_deaths_per_billion_person
1776 33109.8109810981
1777 6081.1113600717
1778 12190.9861668898
1779 12139.5245501
1780 15075.2212389381
1781 15838.2903723287
1782 15772.2685388328
1783 15239.2396766441
1784 2991.7319408181
year count(*) war_deaths_per_billion_person
1400 81 10000.0
1494 137 7267.8730347078
1496 182 10237.3792151449
1528 161 43621.2992645672
1648 77 794106.795723311
1660 189 96384.1853035144
1661 184 101298.815269855
1768 92 16056.2286424355
1769 91 15985.4635428748
dashboard "Sovereign states":
- h1 text: Sovereign states
- h2 text: Number of sovereign states/entities by year
- line chart:
- attr:query: '{"x": "year", "columns": [["year"] + [.[] | .year], ["number of countries"] + [.[] | .["count(*)"]]]}'
- data: "https://gist.githubusercontent.com/kantord/b621e6abbb04fe7fc30b671bc617ccaf/raw/098e1459645fba9258db2a636c2acd950f235c37/number_of_sovereign_states_by_year.csv"
- h2 text: Number of fatalities for 1 billion people in armed conflicts by year
- line chart:
- attr:query: '{"x": "year", "columns": [["year"] + [.[] | .year], ["war deaths per billion person"] + [.[] | .["war_deaths_per_billion_person"]]]}'
- data: "https://gist.githubusercontent.com/kantord/0817fee93a4b5b57711748f3edcec4cf/raw/6e788667673035ff6a0ab997f4adae31ddf27a31/war_deaths_per_population_by_year.csv"
dashboard "Variables example":
- h1 text: Variables Example
- dropdown my_var=pie:
- {"value": pie, "text": "Pie chart"}
- {"value": bar, "text": "Bar chart"}
- p text: "Selected chart type: ${my_var}"
@kantord
kantord / dashboard.yml
Created March 7, 2018 09:43
bad yaml format example
dashboard "Variables example":
- h1 text: Variables Example
- dropdown my_var=pie:
- {"value": pie, "text": "Pie chart"}
- {"value": bar, "text": "Bar chart"}
p text: "Selected chart type: ${my_var}"
@kantord
kantord / dashboard.yml
Last active March 9, 2018 19:55
variables example
dashboard "Food":
- h1 text: Food
- dropdown macro=Protein:
- {"value": "Protein", "text": "Protein"}
- {"value": "Fat", "text": "Fat"}
- {"value": "Sugar", "text": "Sugar"}
- {"value": "Other carbs", "text": "Other carbs"}
- h2 text: By ${macro} content
- bar chart:
- attr:query: '{"columns": [to_entries | .[] | [.key, (.value | .[] | select(.[0] == "${macro}"))[1] ]]}'
dashboard "Example":
-
h1 text: "Lorem ipsum dolor sit amet"
@kantord
kantord / milestone3.js
Created June 11, 2018 19:01
milestone3.js
// @flow
type Environment = {
+left: ?number,
+right: ?number,
}
type AssertionValues = {
+result: ?number,
}