Skip to content

Instantly share code, notes, and snippets.

@antw
antw / active-inputs.js
Last active June 23, 2022 16:25
Active inputs
// Fetch all the inputs.
const inputs = await (
await fetch("https://engine.energytransitionmodel.com/api/v3/scenarios/925016/inputs")
).json();
// Fetch the scenario data, which contains the user_values.
const scenario = await (
await fetch("https://engine.energytransitionmodel.com/api/v3/scenarios/925016?detailed=true")
).json();
@antw
antw / scenario-api-questions.md
Last active May 15, 2020 17:17
Questions about copying / resetting scenarios

Create a copy of a scenario

When creating the new scenario, send the scenario_id of the scenario to be copied (the "source scenario") as part of the JSON body.

// POST /api/v3/scenarios HTTP/2
// Host: engine.energytransitionmodel.com
// Accept: */*
// Content-Type: application/json
@antw
antw / keybase.md
Created July 15, 2016 21:53
keybase.md

Keybase proof

I hereby claim:

  • I am antw on github.
  • I am antw (https://keybase.io/antw) on keybase.
  • I have a public key whose fingerprint is B3C4 5ED4 FFB1 1566 DB1E 1D9A E8EE 1806 1FD9 9D3B

To claim this, I am signing this object:

@antw
antw / js-class.js
Last active October 19, 2015 15:21
Old-style JS class
function TopologyPreviewer(topologyGraph, presetData, style) {
// Private variables.
var privateOne, privateTwo;
// Public variables.
this.publicOne = 1;
this.publicTwo = 2;
// Public methods.
this.preview = function() {
@antw
antw / .gitignore
Last active October 5, 2015 20:24
Moses Network Cache Benchmark
tmp/*
@antw
antw / 01-remove-loss.diff
Last active August 29, 2015 14:07
etengine#716 diffs
diff --git a/nodes/energy/energy_power_hv_network_electricity.ad b/nodes/energy/energy_power_hv_netw
index 93fe2ba..bf6d28e 100644
--- a/nodes/energy/energy_power_hv_network_electricity.ad
+++ b/nodes/energy/energy_power_hv_network_electricity.ad
@@ -1,6 +1,7 @@
- use = undefined
- energy_balance_group = electricity network
-- output.loss = elastic
+- output.loss = 0.0
+- output.electricity = 1.0
@antw
antw / 01-point-1040-limited.txt
Last active August 29, 2015 14:04
Interconnect import/export with Germany, limited by DE price
After including export to Germany @ 13 Feb @ 08:00
--------------------------------------------------
+---+------------------------------------------------+---------+----------+--------+
| | Key | % Used | MWh Load | M.Cost |
+---+------------------------------------------------+---------+----------+--------+
| U | local_demand | - | 12003.00 | - |
| U | export_to_de | - | 430.50 | - |
+---+------------------------------------------------+---------+----------+--------+
| A | energy_chp_supercritical_waste_mix | 100.0 % | 386.42 | 0.00 |
@antw
antw / point-1000.txt
Last active August 29, 2015 14:04
Import from Germany
Before including export to Germany @ Feb 10, 16:00
--------------------------------------------------
+---+------------------------------------------------+---------+----------+--------+
| | Key | % Used | MWh Load | M.Cost |
+---+------------------------------------------------+---------+----------+--------+
| U | local_demand | - | 17466.24 | - |
+---+------------------------------------------------+---------+----------+--------+
| A | energy_chp_supercritical_waste_mix | 100.0 % | 386.42 | 0.00 |
| A | energy_power_wind_turbine_inland | 100.0 % | 187.18 | 0.00 |
@antw
antw / application.js
Created October 27, 2011 21:11 — forked from lachie/application.js
rails 3.1 asset pipeline + stitch/CommonJS
// in app/assets/javascripts/application.js
//= require jquery
//= require jquery_ujs
//= require ./stitch_header
//= require_tree .
@antw
antw / gist:1279408
Created October 11, 2011 20:55
Class Inheritable Attributes in CoffeeScript
# So messy. There must be a better way...
class Model
@property: (name) ->
if @properties? and @properties.length is @.__super__?.constructor.properties?.length
@properties = Array::slice.call @.__super__.constructor.properties, 0
else if not @properties?
@properties = []
@properties.push name