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
bool exists = false; | |
class Tester { | |
Tester() = default; | |
Tester& operator=(const Tester&) { | |
if (exists) | |
throw std::runtime_error{}; | |
else | |
exists = true; | |
} |
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
unmap C-y | |
unmap C-f | |
unmap C-Y | |
unmap C-F | |
unmap h | |
unmap l | |
unmap J | |
unmap K | |
unmap gT | |
unmap gt |
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
#define NFS_CALLBACK(lambdaptr, ...) void callback(uintptr_t l, ##__VA_ARGS__) \ | |
{std::reinterpret_cast<decltype(lambda*)>(*l)(##__VA_ARGS__)} |
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
# create a new city (the 0th city), and set distance to every other city to be 0 | |
from copy import deepcopy | |
# just a fancy way of saying that the best function is cached. ignore this if you don't understand | |
def memoize(fn): | |
CACHE = {} | |
def newfn(*args): | |
if tuple(args) not in CACHE: | |
CACHE[tuple(args)] = fn(*args) | |
return CACHE[tuple(args)] |
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
# create a new city (the 0th city), and set distance to every other city to be 0 | |
from copy import deepcopy | |
def memoize(fn): | |
CACHE = {} | |
def newfn(*args): | |
if tuple(args) not in CACHE: | |
CACHE[tuple(args)] = fn(*args) | |
return CACHE[tuple(args)] |
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
<div class="navbar navbar-inverse navbar-fixed-top"> | |
<div class="container"> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</button> | |
<a class="navbar-brand" href="#">Brand</a> | |
</div> |
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
import re | |
def decode(x): | |
return re.sub("%[0-9A-F][0-9A-F]", lambda x: chr(int(x.group(0)[1:], 16)) , x, flags=re.I, count=100) | |
def eq(a, b): | |
if a != b: | |
print (a, "!=", b) |