Skip to content

Instantly share code, notes, and snippets.

@bogado
bogado / visitor.hpp
Created November 14, 2019 21:02
non throwing visitor
#include <variant>
#include <utility>
#include <type_traits>
#include <array>
#include <tuple>
#include <functional>
#include <optional>
namespace visit {
### Keybase proof
I hereby claim:
* I am bogado on github.
* I am bogado (https://keybase.io/bogado) on keybase.
* I have a public key ASATBvPIsXPwaTttxew7TqmI5sego2cw4xtbjrIwGzjI8go
To claim this, I am signing this object:
@bogado
bogado / backup_functions.sh
Created January 11, 2016 04:23
Simple backup engine to git.
# create a reference if it dosen't exist yet
function __ensure_create_backup_branch()
{
branch_name=$1
reason=$2
if [[ "$reason" != "" ]]; then
reason_flag="-m"
fi
@bogado
bogado / tms
Created February 14, 2013 17:27
tms: tmux split, this command will split your window in several panes, those panes will be synchronized.
#!/bin/sh
cd $1; shift
for i in "$@"; do
tmux split "cd \"$i\"; $SHELL"
tmux select-layout tiled
done
tmux setw syn
#include <iostream>
#include <string>
#include <stdexcept>
#define _XOPEN_SOURCE
#include <unistd.h>
#include <termios.h>
#include <stdio.h>
@bogado
bogado / Fold text modeline
Created March 29, 2010 16:58
vim modeline for setting fold-text
<!-- Search, using a regexp, for a text within the fold to set the fold text based on the match (in this case it folds divs on a html and uses the class and the first heading inside the div). -->
<!-- Procura, usando um regular expression, por um texto dentro do fold para setar o fold text baseado no resultado encontrado (neste caso ele está fazendos folds nos divs e usando a classe do div e o primeiro heading dentro do div -->
<!-- | fold marks | | folddashes|Substitute| Joins all the lines in the fold | Regular expression |Final text | | line count | -->
<!-- vim600:set fdm=marker fmr=<div,</div fdt=v\:folddashes.substitute(join(getline(v\:foldstart,v\:foldend),''),'.\\{-}<div\ class="\\(.\\{-}\\)".\\{-}<h\\d>\\(.\\{-}\\)<\/h\\d>.*','---\\1--\\2','')."\ [".string(v\:foldend-v\:foldstart+1)."\ lines]": -->
CmdUtils.CreateCommand({
names: ["site search"],
icon: "http://www.google.com/favicon.ico",
description: "Search, using google, on the current site only.",
author: {name: "Victor Bogado", email: "victor@bogado.net"},
license: "GPL",
arguments: [{role: 'object', nountype: noun_arb_text}],
preview: function preview(pblock, args) {
pblock.innerHTML = "Search <b>" + args.object.html + "</b> on " + CmdUtils.getDocument().location.host + ".";
},