Skip to content

Instantly share code, notes, and snippets.

Ivan Vergiliev IvanVergiliev

View GitHub Profile
View to_string.cc
#include <cstdlib>
#include <string>
// All of the below are not really standards-compliant, but good enough
// for experiments.
void* operator new(std::size_t size) {
printf("Calling new(%zu).\n", size);
return std::malloc(size);
}
View NonVolatileFlag.java
package io.github.ivanvergiliev;
public class NonVolatileFlag {
private static boolean flag = false;
public static class FlagChecker implements Runnable {
public void run() {
long iter = 0;
while (flag == false) {
++iter;
@IvanVergiliev
IvanVergiliev / power.cc
Created Jul 12, 2015
Compile time Fibonacci
View power.cc
#include <cstdio>
#include <array>
using std::array;
const int MOD = 1000;
class ArrayWrapper {
const array<int, 2>& value;
View gist:bb62c1af502fdfa800fd
var HelloMessage = React.createClass({
render: function() {
return <script>function f() { var a = 5; }</script>;
}
});
@IvanVergiliev
IvanVergiliev / tuple.cpp
Last active Jul 30, 2018
C++ Tuple implementation
View tuple.cpp
#include <cstdio>
template<typename First, typename... Rest>
struct Tuple: public Tuple<Rest...> {
Tuple(First first, Rest... rest): Tuple<Rest...>(rest...), first(first) {}
First first;
};
template<typename First>
@IvanVergiliev
IvanVergiliev / pipe.cc
Last active Dec 20, 2015
Custom binary search using std::lower_bound over used-defined iterators.
View pipe.cc
#include <cstdio>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
struct TestCase {
int N;
int K;
@IvanVergiliev
IvanVergiliev / a_star.cc
Created Oct 23, 2012
Implementation of A* for the 8-puzzle
View a_star.cc
#include <cstdio>
#include <map>
#include <set>
#include <vector>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
@IvanVergiliev
IvanVergiliev / typelist.cc
Created Aug 31, 2012
Partial implementation of the TypeList functionality from Modern C++ Design
View typelist.cc
#include <cstdio>
#include <limits>
#include <iostream>
using namespace std;
class NullType {};
template<typename T, typename U>
class TypeList {
You can’t perform that action at this time.