Skip to content

Instantly share code, notes, and snippets.

View davidpdrsn's full-sized avatar

David Pedersen davidpdrsn

View GitHub Profile
use std::convert::Infallible;
use axum::{
async_trait,
extract::FromRequestParts,
http::{request::Parts, Request, header::CONTENT_LENGTH},
middleware::{from_fn, Next},
response::{Html, IntoResponse, IntoResponseParts, Response},
routing::get,
Router, body::{Full, self},
error[E0308]: mismatched types
--> src/main.rs:5:57
|
5 | let _: Router = Router::with_state(true).route("/", get(|_: State<String>| async {}));
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `String`
| |
| arguments to this function are incorrect
|
= note: expected struct `MethodRouter<bool, _>`
found struct `MethodRouter<String, _>`
use axum::{
extract::{Extension, Path},
routing::get,
AddExtensionLayer, Router,
};
use hyper::service::make_service_fn;
use std::{
convert::Infallible,
sync::{Arc, Mutex},
};
@davidpdrsn
davidpdrsn / lib.rs
Created August 7, 2020 10:21
Seed app
use seed::{prelude::*, *};
pub struct Model {
url: Url,
}
pub enum Msg {
UrlChanged(Url),
}
{
"data": {
"setPlayerArchetype": {
"success": true
}
}
}
(() => {
let Store = {
set:(key, object) => {
var json = JSON.stringify(object);
localStorage.setItem(key, json);
},
get: (key) => {
var json = localStorage.getItem(key);
return JSON.parse(json);
cargo test -j 1
Finished dev [unoptimized + debuginfo] target(s) in 0.24s
Running target/debug/deps/graphql_api-fd1595672b534a18
running 31 tests
test auth::test::test_bearer_pattern ... ok
test cli::run_query::test::test_parsing_operation_name_from_query_with_vars ... ok
test cli::run_query::test::test_parsing_operation_name_from_query ... ok
test cli::run_query::test::test_parsing_valid_url ... ok
test models::factories::test::position_factory ... ok
pub struct CollisionSystem;
impl<'a> System<'a> for CollisionSystem {
type SystemData = (
Entities<'a>,
WriteStorage<'a, Position>,
ReadStorage<'a, Velocity>,
WriteStorage<'a, Collision>,
);
#!/usr/bin/env ruby
require "oga"
require "rest-client"
require "attr_extras"
require "colorize"
require "active_support/core_ext/string"
class String
def print(out = STDOUT)
class QueryTracer
def disallow_queries
return yield unless Rails.env.test?
ActiveSupport::Notifications.unsubscribe("sql.active_record")
subscriber = ActiveSupport::Notifications.subscribe(
"sql.active_record"
) do |_name, _start, _finish, _id, payload|
if payload[:sql].match?(/select/i) && !payload[:sql].include?("pg_")