View effective_modern_cmake.md

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

View CMakeLists.txt
set(LIBFOO_TAR_HEADERS
"${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo_utils.h"
)
add_custom_command(OUTPUT ${LIBFOO_TAR_HEADERS}
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar"
COMMAND ${CMAKE_COMMAND} -E touch ${LIBFOO_TAR_HEADERS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/foo"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar"
View uninstall_vmware.sh
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing $entry ["
sudo rm -rf "$entry"
if [[ ! -e "$entry" ]]; then
echo -ne "OK"
View new-features.cpp
// clang++ -ggdb -std=c++17 -fsanitize=address src/cool-features.cpp -o T
#include <cstdio>
#include <map>
#include <string>
#include <tuple>
using namespace std;
class record {
public:
View threaded-queue.cpp
// Compile With: $ clang++ -ggdb -std=c++17 -fsanitize=address src/main.cpp -o T
#include <condition_variable>
#include <iostream>
#include <mutex>
#include <queue>
#include <sstream>
#include <thread>
int main() {
View boost_split.cpp
#include <boost/algorithm/string.hpp>
#include <string>
#include <vector>
#include <iostream>
int main()
{
std::string splitMe = "aa,b,cc,d";
std::vector<std::string> tokens;
boost::algorithm::split(tokens, splitMe, boost::is_any_of(","));
View mat-to-vector.cpp
#include <iostream>
#include <cstdint>
#include <cstring>
#include <opencv2/opencv.hpp>
int main(int argc, char**argv)
{
if ( argc != 2 )
{
std::cerr << "Usage: " << argv[0] << " <Image_Path>\n";
View .gitconfig
[user]
# Please adapt and uncomment the following lines:
name = Edgar Aroutiounian
email = edgar.factorial@gmail.com
[credential]
helper = osxkeychain
[push]
default = simple
[core]
editor = /Applications/Emacs.app/Contents/MacOS/Emacs
View PhantomTypeReasonML.md

Phantom types in ReasonML

Introduction

"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType

The following write-up is intended as an introduction into using phantom types in ReasonML.

Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.

View DispatchQueueSurprise.m
- (void)testDispatchConcurrentExecutionWithNamedQueuesRaw {
let expectation = [self expectationWithDescription:@"Concurrent execution must happen"];
let semaphore = dispatch_semaphore_create(0);
// global queue, concurrent
let attributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_DEFAULT, 0);
let defaultQueue = dispatch_queue_create("com.pspdfkit.default-concurrent", attributes);
// serial sub-queues that dispatch to concurrent queue
let queue1 = dispatch_queue_create("com.pspdfkit.queue1", DISPATCH_QUEUE_SERIAL);