I hereby claim:
- I am cbsmith on github.
- I am cbsmith (https://keybase.io/cbsmith) on keybase.
- I have a public key ASAP-aANv7TdH9M92MiL7AmjcQmFCR4m9bNymFF-1y6LIgo
To claim this, I am signing this object:
// -*- compile-command: "clang++ -std=c++11 -stdlib=libc++ -Wall -Werror func.cc -o func" -*- | |
#include <iostream> | |
#include <functional> | |
#include <utility> | |
#include <iomanip> | |
//The ugly beast we're wrapping | |
template <typename T1, typename T2, typename T3> | |
struct Hooks3 { | |
virtual bool Fire (int *, T1 t1, T2 t2, T3 t3) { return false; } |
#demonstration of hack to declaratively set param_storage_class declaratively using a decorator | |
#also demonstrates how to write an IPN handler with Flask | |
from flask import Flask, make_response | |
from itertools import chain | |
app = Flask(__name__) | |
#Normally this parameter would come from a config | |
IPN_URLSTRING = 'https://www.sandbox.paypal.com/cgi-bin/webscr' | |
IPN_VERIFY_EXTRA_PARAMS = (('cmd', '_notify-validate'),) |
// -*- compile-command: "clang++ -pedantic -g -O3 -o the_nullptr_story -std=c++0x -stdlib=libc++ the_nullptr_story.cpp" -*- | |
// Simple example of how it is perfectly reasonable to have a pointer that may or may not be nullptr, | |
// and therefore delete a pointer that may or may not be nullptr. | |
// Formatting is a bit unusual/dense to make it easy to focus on the important bits. | |
#include <string> | |
#include <ostream> | |
class Person { | |
public: | |
//Moved to the top so nobody misses it |
"""Traverses the directory tree deleting any .pyc's who do not have a source .py. | |
Helpful when switching between revisions with source control.""" | |
from os.path import join | |
from os import walk, unlink | |
import re | |
import sys | |
PYTHON_RE = re.compile(R'^(.*\.py)(c)?$') | |
global count |
// -*- compile-command: "clang++ -ggdb -o two_stars -std=c++0x -stdlib=libc++ two_stars.cpp" -*- | |
#include <algorithm> | |
#include <iostream> | |
using namespace std; //laziness | |
int main(int argc, char** argv) { | |
int a = 1; | |
int b = 2; | |
int c = 3; |
// -*- compile-command: "clang++ -ggdb -o two_stars_98 -std=c++98 -stdlib=libc++ two_stars_98.cpp" -*- | |
#include <algorithm> | |
#include <iostream> | |
using namespace std; | |
bool points_to_two(int* x) { | |
return *x == 2; | |
} |
// -*- compile-command: "clang++ -ggdb -o test -std=c++11 -stdlib=libc++ test.cpp" -*- | |
#include <iostream> | |
float add(float x, float y) { | |
return x+y; | |
} | |
auto add_fourty_two = +[](float x) { return add(x, 42); }; | |
auto add_pie_and_fourty_two = +[]() { return add_fourty_two(3.1415926); }; |
// -*- compile-command: "clang++ -Weverything -Wno-c++98-compat -ggdb -o test -std=c++11 -stdlib=libc++ test.cpp" -*- | |
#include <iostream> | |
#include <type_traits> | |
template <typename T, typename U, bool boolable = std::is_convertible<T,bool>::value, bool assignable = std::is_assignable<T, U>::value > | |
struct or_assign_helper; | |
template <typename T, typename U> | |
struct or_assign_helper<T, U, true, true> { |
I hereby claim:
To claim this, I am signing this object:
// -*- compile-command: "g++ -O3 -march=native -std=c++11 -Wall -Werror endian.cpp -o endian" -*- | |
#include <fstream> | |
#include <ostream> | |
#include <istream> | |
#include <cstdint> | |
#include <algorithm> | |
#include <cassert> | |
#include <string> | |
#include <vector> | |
#include <limits> |