Skip to content

Instantly share code, notes, and snippets.

View Voltra's full-sized avatar
🎯
Focusing

Voltra

🎯
Focusing
View GitHub Profile
@Voltra
Voltra / lightquery_doc.md
Last active August 4, 2017 15:02
lightquery Documentation

Lightquery - Documentation

lightquery and aliases

You can use lightquery via its many aliases, such as :

  • µ
  • lq
  • lQuery
  • lightQuery
  • LightQuery

immutableLightQuery and why is it so important

@Voltra
Voltra / isLinqCompatible.hpp
Last active July 24, 2018 05:43
Check if a container type can be used as the internals of Linqable
#ifndef LINQ_ISLINQCOMPATIBLE_H
#define LINQ_ISLINQCOMPATIBLE_H
#include <type_traits>
#include "../utils/sfinae/type_exists.h"
namespace linq{
namespace types{
using namespace linq::utils::sfinae;
using std::enable_if;
@Voltra
Voltra / Session.hpp
Created August 17, 2018 15:41
A session middleware for the C++ web framework Crow
#pragma once
#include <functional>
#include <unordered_map>
#include <string>
#include <mutex>
#include <sstream>
#include <locale>
#include <cstdlib>
#include <algorithm>
@Voltra
Voltra / memory_pool.c
Last active February 16, 2019 18:00
Dank memory pool in C
#include "./memory_pool.h"
#include <string.h>
struct memory_pool{
size_t batchSize, allocSize, elemSize;
void** available;
void** inUse;
int availableCursor, inUseCursor;
/*
@Voltra
Voltra / .bashrc
Last active February 7, 2020 19:20
Mfking .bashrc (Polytech)
alias git-add="git add ."
alias git-commit="git commit -a -m"
alias git-push="git push origin master"
alias git-pull="git pull origin master"
alias git-s="git status"
alias git-rm="git rm -r --cached ."
alias git="'/c/Program Files/Git/bin/git.exe'"
clear
@Voltra
Voltra / main.cpp
Created July 10, 2019 12:18
C++ Properties (magic get/set)
#include <iostream>
#include <functional>
#include <utility>
using namespace std;
template <class T>
class property{
public:
using setter_type = function<void(T&, const T&)>;
@Voltra
Voltra / main.cpp
Created August 22, 2019 18:27
C++ UFCS operator@
template <class Range>
Range firstHalf(const Range& r){
auto&& begin = std::begin(r);
auto&& begin_ = begin;
return make<Range>(
begin,
std::next(
begin_,
std::distance(begin, std::end(r))
@Voltra
Voltra / main.pl
Last active October 8, 2019 11:08
First steps with HOP in prolog
last([X], X).
last([_|T], R) :- last(T, R).
first([H|_], H).
concat([], X, X).
concat([H|T], Y, [H|R]) :- concat(T, Y, R).
map(_, [], []).
map(F, [H|T], [R|RT]) :- call(F, H, R), map(F, T, RT).
@Voltra
Voltra / .bash_aliases
Last active April 15, 2020 13:02
Bash Aliases
alias git-add="git add ."
alias git-commit="git commit -a -m"
alias git-push="git push origin master"
alias git-pull="git pull origin master"
alias git-s="git status"
alias git-rm="git rm -r --cached ."
alias git-ac="git-add && git-commit"
alias gf="git flow"
@Voltra
Voltra / index.typing.ts
Created May 29, 2020 22:49
Typescript be like, let's write this by hand everyone
import { Validatueur } from "../api";
import { RuleChain } from "../rules";
import * as I from "./index";
// "module augmentation", magically merges
// why we have to do this and not just extend manually ?
// who knows at this point
declare module "../rules" {
interface RuleChain<T, U> {
/****************************************************************************\