Skip to content

Instantly share code, notes, and snippets.

@cout
cout / playwright_promise_tracker_mocha_hooks.js
Last active June 8, 2021 21:12
Promise tracker for mocha tests that use playwright
const async_hooks = require('async_hooks'); [19/2778]
const util = require('util');
const _ = require('lodash');
const ignore_promise = function(stack) {
// Promises created by these functions are all part of the internal
// workings of the playwright server. It is normal for them to be
// unsettled after a test has completed.
if (stack.match(/DispatcherConnection\.dispatch/)) { return true; }
if (stack.match(/VideoRecorder\._sendFrames/)) { return true; }
@cout
cout / gist:a2565c57db273811083840cba4deccf3
Created March 31, 2020 16:07
livesplit-one-desktop build error
error[E0659]: `path` is ambiguous (built-in attribute vs any other name)
--> src/renderer/mod.rs:244:13
|
244 | glsl_to_spirv_macros::include_glsl_vs!("src/renderer/quad.vert")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name
|
= note: `path` could refer to a built-in attribute
note: `path` could also refer to the derive helper attribute defined here
--> <::glsl_to_spirv_macros::include_glsl_vs macros>:4:42
|
@cout
cout / test.cpp
Created March 19, 2017 02:45
change in behavior from clang 3.9 to 4.0
#include <iostream>
struct Base
{
};
struct Derived : Base
{
using Base::Base;
};
@cout
cout / test.cpp
Created March 17, 2017 13:46
Experimental BDD front-end for gtest
#include <functional>
#include <string>
#include <memory>
#include <typeinfo>
#include <boost/optional.hpp>
#include <gtest/gtest.h>
using Before = std::function<void()>;
struct X
{
X() = default;
X(X &&) = delete;
X(X const &) = default;
};
X foo()
{
X x;
@cout
cout / mktime_localtime_dst_weirdness.cpp
Created March 13, 2017 16:50
mktime/localtime DST weirdness
#include <iostream>
#include <time.h>
int main()
{
time_t t = 1489377600;
std::cout << ctime(&t) << std::endl; // Mon Mar 13 00:00:00 2017
tm l;
@cout
cout / gist:68274b287b8e05aa20dc
Created November 3, 2015 13:07
no member named 'gets' in the global namespace
$ cat test.cpp
#include <cstdio>
int main() { }
$ /home/pbrannan/bin/clang++-3.7 test.cpp -Wall -Werror -std=c++11
$ /home/pbrannan/bin/clang++-3.7 test.cpp -Wall -Werror -std=c++14
In file included from test.cpp:1:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
using ::gets;
~~^
1 error generated.
dots = {
0 => [ "\u28c0", "\u2884", "\u2882", "\u2881" ],
1 => [ "\u2860", "\u2824", "\u2822", "\u2821" ],
2 => [ "\u2850", "\u2814", "\u2812", "\u2811" ],
3 => [ "\u2848", "\u280c", "\u280a", "\u2809" ],
nil => [ "\u2840", "\u2804", "\u2802", "\u2801" ],
}
values = ARGV.map { |x| x.to_f }
min, max = values.minmax
1.9.3-p0 :002 > m = Module.new; m.class_eval("A = 1"); m.constants
=> [:A]
1.9.3-p0 :003 > m = Module.new; m.class_eval { A = 1 }; m.constants
=> []