Adapted from this gist, as the original one seems to have some formatting problems. All credits go to the original creator.
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
(defun recompile-elc-on-save () | |
"If you're saving an elisp file, likely the .elc is no longer valid." | |
(make-local-variable 'after-save-hook) | |
(add-hook 'after-save-hook | |
(lambda () | |
(if (file-exists-p (byte-compile-dest-file buffer-file-name)) | |
(byte-compile-file buffer-file-name))))) | |
(add-hook 'emacs-lisp-mode-hook 'recompile-elc-on-save | |
) |
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
#ifndef BENCHMARK_HPP | |
#define BENCHMARK_HPP | |
/*! | |
* \file benchmark.hpp | |
* | |
* Benchmark for functions in C++. Use it only in release mode. | |
*/ | |
#include <iostream> | |
#include <functional> |
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
#ifndef AND_THEN_HPP | |
#define AND_THEN_HPP | |
#include <optional> | |
#include <functional> | |
#include <type_traits> | |
template<typename T1, | |
typename Func, | |
typename Input_Type = typename T1::value_type, |
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
module Main exposing (..) | |
import Browser | |
import Html exposing (Html) | |
import Svg exposing (..) | |
import Svg.Attributes exposing (..) | |
import Svg.Lazy | |
import Task | |
import Time | |
import Random |
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
#include <type_traits> | |
namespace detail { | |
template <typename Func> | |
struct function_trait; | |
#define BEYOND_NOARG | |
#define BEYOND_FUNCTION_TRAIT(CV_OPT, NOEXCEPT_OPT) \ |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>Feeds of Lesley Lai from Inoreader [https://www.inoreader.com]</title> | |
</head> | |
<body> | |
<outline text="Arts" title="Arts"> | |
<outline text="Sarah's Scribbles" title="Sarah's Scribbles" type="rss" xmlUrl="https://sarahcandersen.com/rss" htmlUrl="http://sarahcandersen.com/"/> | |
</outline> | |
<outline text="Tech Blog" title="Tech Blog"> |
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
template <typename Callable, typename... Params> | |
auto curry(Callable f, Params... ps) | |
{ | |
if constexpr (requires { f(ps...); }) { | |
return f(ps...); | |
} else { | |
return [f, ps...] (auto... qs) | |
{ | |
return curry(f, ps..., qs...); | |
}; |
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
auto locate_asset_path(const std::filesystem::path& current_path) | |
-> std::optional<std::filesystem::path> | |
{ | |
namespace fs = std::filesystem; | |
std::optional<fs::path> result = std::nullopt; | |
for (auto path = current_path; path != current_path.root_path(); | |
path = path.parent_path()) { | |
const auto assets_path = path / "assets"; | |
if (exists(assets_path) && is_directory(assets_path)) { |