Skip to content

Instantly share code, notes, and snippets.

@vsapsai
vsapsai / gist:3288057
Created August 7, 2012 18:23
getopt test
#include <assert.h>
#include <iostream>
#include "iwyu_getopt.h"
#include <getopt.h> // Don't ask me why such incude order.
void AssertGlobalValues(int result) {
// char *system_optarg = optarg;
// char *iwyu_optarg = iwyu::optarg;
// if (system_optarg != iwyu_optarg) {
// std::cout << "Place for breakpoint\n";
@vsapsai
vsapsai / gist:7290949
Created November 3, 2013 14:42
Explanation of thought process for transitive_desired_includes.patch in IWYU issue #105. It was fun to write explanation like a dialog and I don't want to loose this text (thought it's useless).
Thought process was the following:
- How do we know that we don't need to #include <string> in sub.h, sub.cc?
- Well, sub.h won't compile without #include "base.h" and base.h requires <string>.
- But how can we tell that base.h requires <string>?
- The same way we decide that <string> is a desired include for sub.h, sub.cc. There is a full use of symbol std::string in sub.h, sub.cc, and <string> provides symbol std::string. So you need just to check if there are full uses, forward-declaration uses in base.h (and all other included headers).
- ...(awkward silence)
- Also, have you noticed that usage of std::string in base.cc doesn't trigger recommendation to #include <string> in base.cc?
- Yeah, <string> is accessible in base.cc via base.h, it's an associated include. So no need to #include <string> both in base.h and base.cc.
@vsapsai
vsapsai / README.md
Last active August 29, 2015 13:56
All features.

Demonstrate all features present in ukraine_map_data/ukraine.json.

@vsapsai
vsapsai / README.md
Last active August 29, 2015 13:56
Highlight selected region.

Demonstrate how you can highlight a specific region. Note: regions' names are in Ukrainian.

@vsapsai
vsapsai / README.md
Last active August 29, 2015 13:57
Map with timeline.

Demonstrate how you can display on a map data that changes during some period of time.

Please, note that this example is not a reliable source of information about 2014 Ukrainian Regional State Administration occupations. I've tried to be correct, but I might have done a few mistakes. See data_explanation.md for more details.

@vsapsai
vsapsai / README.md
Last active August 29, 2015 13:57 — forked from vsapsai/README.md
Map with timeline and legend.

Demonstrate how you can display on a map data that changes during some period of time and how to create a legend.

Please, note that this example is not a reliable source of information about 2014 Ukrainian Regional State Administration occupations. I've tried to be correct, but I might have done a few mistakes. See data_explanation.md for more details.

@vsapsai
vsapsai / README.md
Created April 12, 2014 20:39
SVG path animations with D3.js.
@vsapsai
vsapsai / README.md
Last active October 23, 2019 22:13 — forked from mbostock/.block
Kyiv Metro digital clock.

Digital clock like in Kyiv Metro, 1970s style. Reference image is provided by Metro Museum.

@vsapsai
vsapsai / README.txt
Last active August 29, 2015 14:00
Description to change later
Steps to reproduce:
1. Create gist with non-empty description.
2. Add binary file to the gist.
3. Try to change description.
@vsapsai
vsapsai / extern_template.cc
Created May 5, 2014 13:32
"extern template" test case.
// extern_template.h, .cc don't correspond to interface/implementation pattern.
// They have the same name so that IWYU prints recommendations for both files.
#include "extern_template.h"
#include "indirect.h"
class IndirectClass;
void foo() {
ExternTemplateClass<IndirectClass> et;