Skip to content

Instantly share code, notes, and snippets.

View matts1's full-sized avatar

Matt matts1

  • Google
  • Sydney, Australia
  • 09:02 (UTC +10:00)
View GitHub Profile
bool exists = false;
class Tester {
Tester() = default;
Tester& operator=(const Tester&) {
if (exists)
throw std::runtime_error{};
else
exists = true;
}
unmap C-y
unmap C-f
unmap C-Y
unmap C-F
unmap h
unmap l
unmap J
unmap K
unmap gT
unmap gt
#define NFS_CALLBACK(lambdaptr, ...) void callback(uintptr_t l, ##__VA_ARGS__) \
{std::reinterpret_cast<decltype(lambda*)>(*l)(##__VA_ARGS__)}
# 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)]
# 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)]
@matts1
matts1 / gist:77f11eace112ae284f23
Created November 7, 2014 08:29
double jumbotron
<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>
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)