Skip to content

Instantly share code, notes, and snippets.

Jonas Platte jplatte

  • Fraunhofer IEE
  • Germany
Block or report user

Report or block jplatte

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jplatte
jplatte / ruma-events.md
Last active Oct 11, 2019
ruma-events notes
View ruma-events.md

ruma-events

Overview

  • There is a hierarchy of event traits: Event > RoomEvent > StateEvent
  • There is a Rust type for each kind of event (each allowed value for the 'type' field of the json representation), including custom [room / state] events
  • There is also a content type for each event type
  • In addition, there are "special" event types:
    • the Event, RoomEvent and StateEvent enums from collections::all contain every event type
View gist:21e45bf90b77dd8a35084bafec167f79
swaymsg -t get_tree | jq -r '.nodes[] | select([recurse(.nodes[]?, .floating_nodes[]?) | .focused] | any) | .name'
View anvil-fmt.diff
diff --git a/anvil/src/input_handler.rs b/anvil/src/input_handler.rs
index 1d91554..e4a63fa 100644
--- a/anvil/src/input_handler.rs
+++ b/anvil/src/input_handler.rs
@@ -131,12 +131,14 @@ impl<B: InputBackend> InputHandler<B> for AnvilInputHandler {
self.running.store(false, Ordering::SeqCst);
}
#[cfg(feature = "tty_lauch")]
- KeyAction::VtSwitch(vt) => if let Some(ref mut session) = self.session {
- info!(log, "Trying to switch to vt {}", vt);
View keybase.md

Keybase proof

I hereby claim:

  • I am jplatte on github.
  • I am jplatte (https://keybase.io/jplatte) on keybase.
  • I have a public key ASCw2BYUeQV-zliaUjaXzxRVVInsM9e0JG8EhDTe6XYd1Qo

To claim this, I am signing this object:

View algebra-cxx14_example.cpp
#include <algebra_cxx14.hpp>
#include <cmath>
#include <iostream>
using namespace std;
using namespace algebra_cxx14::exports;
#define TAG(_name_) struct _name_ { static constexpr const char* name = #_name_; }
TAG(X);
@jplatte
jplatte / guard.hpp
Last active Jul 21, 2016
Guards for Boost Hana
View guard.hpp
#include <boost/hana.hpp>
#include <type_traits>
namespace hana = boost::hana;
template <typename Cond, typename Then>
constexpr auto guard(Cond&& cond, Then&& then)
{
return hana::eval_if(std::forward<Cond>(cond),
std::forward<Then>(then),
@jplatte
jplatte / enum_str.hpp
Last active Feb 19, 2016
Enum to string and string to enum conversion, DRY-style
View enum_str.hpp
#ifndef _ENUM_STR_HPP_
#define _ENUM_STR_HPP_
#include <initializer_list>
#include <map>
#include <stdexcept>
#include <string>
#include <type_traits>
namespace _enum_str
View clippy.hs
clippy :: String
clippy = unlines
[ "╭──╮ "
, "│ │ "
, "@ @ "
, "││ ││"
, "││ ││"
, "│╰─╯│"
, "╰───╯"]
@jplatte
jplatte / named_params.hpp
Last active Feb 3, 2016
Named parameters with C++14 (mandatory ones only, to keep the code short)
View named_params.hpp
// Based on https://gist.github.com/ilpropheta/7576dce4c3249df89f85
// Works with:
// * g++ (since 4.9.2, potentially before)
// * clang (since 3.5, potentially before)
// * Visual C++ (since version 14 / 2015)
#ifndef _NAMED_PARAMS_HPP_
#define _NAMED_PARAMS_HPP_
#include <type_traits> // std::is_same
You can’t perform that action at this time.