Skip to content

Instantly share code, notes, and snippets.

#include <utility>
#include "Function_ref.h"
#include "S3ErgodicMoves.h"
#include "SimplicialManifold.h"
auto increment_lambda = [](int a) { return ++a; };
function_ref<int(int)> lambda_ref(increment_lambda);
increment_lambda(0); // = 1
lambda_ref(5); // = 6
@acgetchell
acgetchell / async-worker.cpp
Last active September 19, 2016 12:58
Asynchronous worker
/**
* Copyright (C) 2012-2014 Ciere Consulting, ciere.com
* Copyright (C) 2010-2011 Object Modeling Designs
*
*
* Write an object that will let you queue
* an operation and a single integer value.
*
* When the object's go method is called it
* cycles through each queued operation passing the
#include <functional>
#include <iostream>
#include <vector>
int sum(int a, int b) { return a + b; }
int sub(int a, int b) { return a - b; }
struct multiply {
int operator()(int a, int b) { return a * b; }

Keybase proof

I hereby claim:

  • I am acgetchell on github.
  • I am adamgetchell (https://keybase.io/adamgetchell) on keybase.
  • I have a public key whose fingerprint is 54C3 993B C757 653A 2D50 DFE3 ABC4 1775 2F12 AB33

To claim this, I am signing this object:

@acgetchell
acgetchell / vector_with_allocator.cpp
Last active June 6, 2016 21:09
A templatized vector with memory allocator
#include <iostream>
//#include <stdexcept>
using namespace std;
template<class T, class A = allocator<T>>
class vector {
int sz;
T* elem;
int space;
A a;
@acgetchell
acgetchell / Delaunay_triangulation_3.h
Created January 10, 2016 00:46
Delaunay triangulation 3 with serial/parallel marker
// Copyright (c) 1999-2004 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
@acgetchell
acgetchell / vscode-aspnet5-macosx
Last active December 11, 2015 20:21
Getting VSCode and .NET 5 up and running on MacOSX
┌─[adam][hapkido][~]
└─▪ brew cask install visual-studio-code
==> Downloading https://az764295.vo.msecnd.net/public/0.10.1-release/VSCode-darw
######################################################################## 100.0%
==> Symlinking App 'Visual Studio Code.app' to '/Applications/Visual Studio Code
🍺 visual-studio-code staged at '/opt/homebrew-cask/Caskroom/visual-studio-code/0.10.1' (1675 files, 177M)
┌─[adam][hapkido][~]
└─▪ brew install mono
==> Downloading https://homebrew.bintray.com/bottles/mono-4.2.0.179.el_capitan.b
@acgetchell
acgetchell / container_test.cpp
Created November 1, 2015 01:00
A test showing that std::vector<std::pair<Point, unsigned>> doesn't work but std::pair<std::vector<Point>, std::vector<unsigned>> does.
// CGAL headers
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/Triangulation_cell_base_with_info_3.h>
#include <CGAL/point_generators_3.h>
// C headers
// #include <math.h>
@acgetchell
acgetchell / traits
Created September 30, 2015 13:39
Traits example
Orientation
orientation(const Point &p, const Point &q,
const Point &r, const Point &s) const
{
return geom_traits().orientation_3_object()(p, q, r, s);
}
From https://github.com/CGAL/cgal/blob/master/Triangulation_3/include/CGAL/Triangulation_3.h
@acgetchell
acgetchell / simple-tuple-get
Last active September 23, 2015 06:47
Sometimes the direct simple way is best.
// Example program
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
template <typename T>
auto myFunc(T&& tuple) {
std::get<0>(tuple).erase( std::get<0>(tuple).begin()+1);
}