Skip to content

Instantly share code, notes, and snippets.

View jimmycuadra's full-sized avatar
☠️
GitHub profits from the separation of families and the deaths of children.

jimmycuadra

☠️
GitHub profits from the separation of families and the deaths of children.
View GitHub Profile
@jimmycuadra
jimmycuadra / main.rs
Created February 14, 2017 10:53
Resolving a series of associated types
trait HasEndpoint {
type Endpoint: Endpoint;
}
trait Endpoint {
type Request: Default + ToString;
}
struct Foo;
@jimmycuadra
jimmycuadra / Cargo.lock
Created January 27, 2017 11:53
Cargo won't use ruma-signatures 0.2.1
[root]
name = "ruma"
version = "0.1.0"
dependencies = [
"argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bodyparser 0.5.0 (git+https://github.com/jimmycuadra/body-parser?branch=serde-0.9)",
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
@jimmycuadra
jimmycuadra / endpoint_v2.rs
Created January 16, 2017 05:45
Rough idea for a revision of ruma-api (using generic parameters instead of associated types)
pub trait Endpoint<RQ, RS, S> where RQ: BuildRequest, RS: BuildResponse<S> {
fn build_request() -> RQ;
fn build_response() -> RS;
fn info() -> Info;
}
pub struct Info {
pub description: &'static str,
pub name: &'static str,
pub rate_limited: bool,
@jimmycuadra
jimmycuadra / endpoint_v2.rs
Created January 16, 2017 05:18
Rough idea for a revision of ruma-api
pub trait Endpoint {
type Request: Request;
type Response: Response;
fn info() -> Info;
}
pub struct Info {
pub description: &'static str,
pub name: &'static str,
@jimmycuadra
jimmycuadra / kibana.tmpl.yml
Created November 18, 2016 04:16
Exposing a Kubernetes service (in this example, AWS Elasticsearch Service + Kibana) with an ingress resource an oauth2_proxy.
---
kind: "Template"
apiVersion: "v1"
metadata:
name: "kibana"
objects:
- kind: "Namespace"
apiVersion: "v1"
metadata:
name: "kibana"
@jimmycuadra
jimmycuadra / cargo_build_output.txt
Created September 23, 2016 23:43
Constructor in macro expansion
As is:
error: expected expression, found `AnswerEvent`
--> src/api/r0/event_creation.rs:42:9
|
42 | $name {
| ^^^^^
----------
I'm hoping to release 0.1.0 by the end of the year
https://github.com/ruma/ruma/milestone/1
In other words, no federation, only the most critical APIs implemented
when I get back to work on it next week, my next steps are to write some tests for the message sending API
and then to work on the state event creation APIs
once those are done, the logic for validating state events on creation will be in place, so finishing the create room API will be possible
the /sync API will be the final beast for 0.1.0
with the join/invite APIs being thrown in there somewhere and likely somewhat easier than the others
the two big question marks in my mind right now are 1) a better approach to the equivalent of synapse's state groups 2) the architecture of /sync and how to make it performant
$ rustup --verbose update nightly
verbose: read metadata version: '12'
verbose: updating existing install for 'nightly-x86_64-apple-darwin'
verbose: toolchain directory: '/Users/redacted/.multirust/toolchains/nightly-x86_64-apple-darwin'
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
verbose: creating temp file: /Users/redacted/.multirust/tmp/x1jysmg0eexmb81g_file
verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-nightly.toml.sha256'
verbose: downloading with curl
verbose: deleted temp file: /Users/redacted/.multirust/tmp/x1jysmg0eexmb81g_file
verbose: toolchain is already up to date
@jimmycuadra
jimmycuadra / gist:baa8c4fcc00d36d9c4acc73624f1acf4
Created June 21, 2016 08:24
Synapse error with fresh checkout @ bc72d38
$ ./synctl start
Starting ...
2016-06-21 01:21:58,748 - synapse.python_dependencies - 107 - INFO - - Using 'bcrypt' version None from '/redacted/.pyenv/versions/synapse/lib/python2.7/site-packages/bcrypt/__init__.pyc' to satisfy 'py-bcrypt'
2016-06-21 01:21:58,749 - synapse.python_dependencies - 107 - INFO - - Using 'frozendict' version None from '/redacted/.pyenv/versions/synapse/lib/python2.7/site-packages/frozendict/__init__.pyc' to satisfy 'frozendict>=0.4'
2016-06-21 01:21:58,749 - synapse.python_dependencies - 107 - INFO - - Using 'OpenSSL' version '16.0.0' from '/redacted/.pyenv/versions/synapse/lib/python2.7/site-packages/OpenSSL/__init__.pyc' to satisfy 'pyopenssl>=0.14'
2016-06-21 01:21:58,749 - synapse.python_dependencies - 107 - INFO - - Using 'pydenticon' version None from '/redacted/.pyenv/versions/synapse/lib/python2.7/site-packages/pydenticon/__init__.pyc' to satisfy 'pydenticon'
2016-06-21 01:21:58,749 - synapse.python_dependencies - 107 - INFO - - Using 'pymacaroons' version '0.9.0' from '/r
@jimmycuadra
jimmycuadra / lib.rs
Created May 22, 2016 17:38
Tuple pattern match in for loop
src/lib.rs:210:17: 210:36 error: mismatched types [E0308]
src/lib.rs:210 for (field_name, field) in &numbers_to_check {
^~~~~~~~~~~~~~~~~~~
src/lib.rs:210:17: 210:36 help: run `rustc --explain E0308` to see a detailed explanation
src/lib.rs:210:17: 210:36 note: expected type `&(&str, std::option::Option<tests::PhoneNumber>)`
src/lib.rs:210:17: 210:36 note: found type `(_, _)`