Skip to content

Instantly share code, notes, and snippets.

View pferreir's full-sized avatar
💭
Hacking

Pedro Ferreira pferreir

💭
Hacking
View GitHub Profile
use amethyst::{
assets::{AssetLoaderSystemData, ProgressCounter},
core::{Transform, TransformBundle},
ecs::System,
prelude::*,
renderer::{
bundle::RenderingBundle,
debug_drawing::DebugLines,
light::{Light, PointLight},
palette::{LinSrgba, Srgb},
diff --git a/src/core/simulation/simulation.rs b/src/core/simulation/simulation.rs
index 414411e..3384367 100644
--- a/src/core/simulation/simulation.rs
+++ b/src/core/simulation/simulation.rs
@@ -63,7 +63,7 @@ impl<'a> Simulation<'a> {
}
}
InputChange::Money(amount) => {
- *state.resources.get_mut(&Resource::Money).unwrap() += amount;
+ state.subtract_resources(&vec![(Resource::Money, *amount)]);
use async_std::{
stream::StreamExt,
sync::{channel, Sender, Receiver}
};
use futures::join;
async fn producer_1(sender: Sender<String>) {
let mut i = 0;
loop {
let s = format!("PROD1 {}", i);
# run it like this:
# FLASK_ENV=development FLASK_DEBUG=1 FLASK_APP=testsvc.py flask run -p 12345
from functools import wraps
import requests
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.exc import IntegrityError
from webargs import fields
Pedro Ferreira
Project Lead and Service Manager, Indico
https://getindico.io
+-----------+
+ '``'--- `+ CERN - European Organization for Nuclear Research
+ |CERN| / + 1211 Geneve 23, Switzerland
+ ..__. \. + IT-CDA-IC
+ \\___.\ + Office: 28-1-020
import React from 'react';
import {shallow} from 'enzyme';
import FileManager, {FileType} from '../components/FileManager';
const data = [
{
id: '1',
name: 'Source file',
contentTypes: ['text/plain'],
diff --git a/Cargo.toml b/Cargo.toml
index ddcf743..5ca90f2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,9 +11,10 @@ reqwest = "0.9.19"
serde = "1.0.98"
serde_json = "1.0.40"
regex = "1.2.0"
-diesel = {version = "1.4.2", features = ["sqlite"]}
+diesel = {version = "1.4.2", features = ["sqlite", "r2d2"]}
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..6841335
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,2197 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "adler32"
diff --git a/Cargo.toml b/Cargo.toml
index ddcf743..5ca90f2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,9 +11,10 @@ reqwest = "0.9.19"
serde = "1.0.98"
serde_json = "1.0.40"
regex = "1.2.0"
-diesel = {version = "1.4.2", features = ["sqlite"]}
+diesel = {version = "1.4.2", features = ["sqlite", "r2d2"]}