Skip to content

Instantly share code, notes, and snippets.

View Bloodb0ne's full-sized avatar

Emilian Bloodb0ne

View GitHub Profile
let title = ""
let desc = ""
let image = ""
layer.bindPopup(`${title} <br/> ${desc} <br/> <img src="${image}" alt="${desc}"/>`
@Bloodb0ne
Bloodb0ne / BTL
Last active October 6, 2020 17:17
BTL PAT 363734
PAT 112510
PAT 160410
PAT 110411
PAT 361637
MODE (1,1)(WRP,RUN,SQR)
WBT (1,1)(ABCD,0123,WXYZ)
XL (1,1)1(0...)
CH CHV (1,1) XLOC,SET,5,344
bool isValidOffset(int x,int y,int width,int height){
if(x < 0 || x > width) return false;
if(y < 0 || y > width) return false;
return true;
}
@Bloodb0ne
Bloodb0ne / Math_Parser_Example.cpp
Created April 8, 2020 19:21
Parser Combinators Math Example
constexpr auto single_sum = [](auto)->std::function<int(int, int)> { return [](int a, int b) { return a + b; }; };
constexpr auto single_sub = [](auto)->std::function<int(int, int)> { return [](int a, int b) { return a - b; }; };
constexpr auto single_mul = [](auto)->std::function<int(int, int)> { return [](int a, int b) { return a * b; }; };
constexpr auto single_div = [](auto)->std::function<int(int, int)> { return [](int a, int b) { return a / b; }; };
constexpr auto prefix_double = [](auto)->std::function<int(int)> { return [](int a) { return a * a; }; };
constexpr auto prefix_neg = [](auto)->std::function<int(int)> { return [](int a) { return -a; }; };
auto mathParser =
@Bloodb0ne
Bloodb0ne / JSON_Example_Parser.cpp
Last active April 8, 2020 19:08
Parser Combinator JSON Example
//Transformations
constexpr auto to_string = [](auto v) { return std::string(1, v); };
constexpr auto vec_to_string = [](auto v) {
return std::accumulate(v.begin(), v.end(), std::string{});
};
//Grammar
constexpr auto ws = monadic::Many(symbs<'\n', '\t', '\r',' '>() % to_string);
constexpr auto str_wrap = Wrapper('"'_symb, '"'_symb);
constexpr auto obj_wrap = Wrapper('{'_symb, '}'_symb);
@Bloodb0ne
Bloodb0ne / ManyParser.cpp
Created March 20, 2020 12:54
Parser Combinators Example
template<typename Parser>
struct Many {
using is_parser_type = std::true_type;
using return_type = typename std::vector<typename Parser::return_type>;
using temp_result_type = typename Parser::return_type;
Parser const p;
Many(Parser const& p_) :p(p_) {};
//CAN REPEAT 0 Times
@Bloodb0ne
Bloodb0ne / RepeatParser.cpp
Created March 20, 2020 12:29
Parser Combinators Example
template<typename Parser>
struct Repeat {
using is_parser_type = std::true_type;
using return_type = typename std::vector<typename Parser::return_type>;
using temp_result_type = typename Parser::return_type;
Parser const p;
Repeat(Parser const& p_) :p(p_) {};
@Bloodb0ne
Bloodb0ne / SequenceParser.cpp
Created March 20, 2020 12:22
Parser Combinator Examples
template<typename ...Parsers>
struct Seq {
using is_parser_type = std::true_type;
using return_type = typename std::tuple<typename Parsers::return_type...>;
using container_type = typename std::tuple<Parsers...>;
container_type const parsers;
@Bloodb0ne
Bloodb0ne / BaseParser.cpp
Created March 19, 2020 13:23
Parser Combinators Example
struct SampleParser {
using is_parser_type = std::true_type;
using return_type = int;
template<typename Iterator>
bool operator()(Iterator& it, Iterator end, return_type* r) const{
return true;
}
};
@Bloodb0ne
Bloodb0ne / OpenCLProjectWizardWPF.cs
Created June 17, 2019 09:23
Sample code for WPF Project Wizard Dialog, tried styling it like a native looking dialog but that didnt really pan out
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TemplateWizard;
//using System.Windows.Forms;
using EnvDTE;
using Microsoft.VisualStudio.PlatformUI;
using System.Windows.Controls;
using System.Windows.Media;
using Microsoft.VisualStudio.Shell;