This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Inspired to the work of hliberacki: https://github.com/hliberacki/cpp-member-accessor | |
* But made it much shorter, and works even with C++98. | |
* | |
* Usage: | |
* | |
* class PrivateStuff | |
* { | |
* int dont_steal; | |
* }; | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace error_on_date { | |
inline constexpr bool strequal(char const *a, char const *b) { | |
return *a == *b && (*a == '\0' || strequal(a + 1, b + 1)); | |
} | |
} | |
#if defined(ERROR_ON_DATE$$USE_CLASS) && ERROR_ON_DATE$$USE_CLASS | |
namespace error_on_date { | |
struct date { | |
constexpr date(unsigned int year, unsigned int month, unsigned int day): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.reactivex.Observable; | |
import io.reactivex.ObservableSource; | |
import io.reactivex.ObservableTransformer; | |
import io.reactivex.functions.Function; | |
import java.util.Optional; | |
public class MapIgnoreNulls { | |
public static <T,R> ObservableTransformer<T,R> create(Function<? super T, ? extends R> mapper) { | |
return observable -> observable | |
.map(t -> Optional.ofNullable(mapper.apply(t))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################## | |
# Two bash functions to get info about device nodes in Linux. # | |
# Feel free to use and share, respecting the below license. :) # | |
# # | |
# Copyright © 2017 Fabio Alemagna # | |
# # | |
# Redistribution and use in source and binary forms, with or without modification, are permitted # | |
# provided that the following conditions are met: # | |
# # | |
# 1. Redistributions of source code must retain the above copyright notice, this list of # |