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 <stdexcept> | |
#include <memory> | |
#include <limits> | |
#include <sqlite3.h> | |
#include <assert.h> | |
namespace sql { |
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
// MARK: - UITableViewDelegate methods | |
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
let margin: CGFloat = 8 | |
var size = CGSize(width: cell.bounds.height - margin, height: cell.bounds.height - margin) | |
if cell.imageView!.image!.size.width > cell.imageView!.image!.size.height { | |
let factor = cell.imageView!.image!.size.width / cell.imageView!.image!.size.height; | |
size.height = size.height / factor; | |
} | |
else { |
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
/* My tiny gzip decompressor without using zlib. - Joel Yliluoma | |
* http://iki.fi/bisqwit/ , http://youtube.com/user/Bisqwit | |
* Inspired and influenced by a 13th IOCCC winner program by Ron McFarland */ | |
/* Fun fact: Contains zero new/delete, and no STL data structures */ | |
#include <assert.h> | |
// This is the public method declared (later) in this file. | |
template<typename InputFunctor, typename OutputFunctor> | |
void Deflate(InputFunctor&& input, OutputFunctor&& output); |
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
digraph { | |
ranksep=.75 | |
" " // end node | |
{ | |
node [shape=plaintext, fontsize=12] | |
1973 -> 1983 -> 1990 -> 1996 -> 2000 -> 2001 -> 2004 -> 2005 -> 2010 -> 2011 -> 2014 | |
"ML"; "C++"; "Standard ML"; "OCaml"; "C#"; D; Scala; "F#"; Rust; Ceylon; Kotlin; Swift | |
} | |
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 <iostream> | |
#include <iomanip> | |
#include <fstream> | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
#include <deque> | |
#include <array> |
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 literals { // inspired by http://codereview.stackexchange.com/a/51576 | |
constexpr int64_t combine(int64_t accumulator) { | |
return accumulator; | |
} | |
template <typename... Characters> | |
constexpr int64_t combine(int64_t accumulator, char character, Characters... Rest) { | |
int digit = (character >= '0' && character <= '9') ? character - '0' | |
: throw std::range_error("Only decimal literals are supported."); |
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
#pragma once | |
#include <type_traits> | |
namespace raii { | |
template <class T> | |
class pointer { | |
template <typename D> |
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 <CoreFoundation/CoreFoundation.h> | |
#include <sqlite3/sqlite3.h> | |
#include <cstdio> | |
#include <iterator> | |
#include <vector> | |
#include "raii/raii.hpp" | |
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 <cxxabi.h> // gcc and clang… | |
#include <stdlib.h> | |
auto demangle(std::string&& name) -> std::unique_ptr<char, void(*)(char *)> | |
{ | |
int status = 0; | |
return { abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status), [] (char * p) { ::free(p); } }; | |
} |
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... T, int... I> | |
static auto subtuple(std::tuple<T...>&& tuple, std::index_sequence<I...>) { | |
return std::make_tuple(std::get<I>(tuple)...); | |
} |