Skip to content

Instantly share code, notes, and snippets.

@TheVice
TheVice / configure.cmd
Last active November 16, 2015 15:27
Configure scripts for C\C++ projects based on CMAKE build tool
:: The MIT License (MIT)
:: Copyright (c) 2013 - 2015 https://github.com/TheVice/
:: Permission is hereby granted, free of charge, to any person obtaining a copy
:: of this software and associated documentation files (the "Software"), to deal
:: in the Software without restriction, including without limitation the rights
:: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
:: copies of the Software, and to permit persons to whom the Software is
@TheVice
TheVice / Program.cpp
Created August 7, 2016 11:58
Several GLFW windows in own threads
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 https://github.com/TheVice/
*
*/
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
@TheVice
TheVice / CMakeLists.txt
Created November 10, 2016 21:46
Instance limiter (WIN32) - threre was a task to make library that control count of app count on local PC and via local network. As reference used https://msdn.microsoft.com/en-us/library/windows/desktop/ms686701(v=vs.85).aspx (local PC) and https://web.archive.org/web/20140131015856/http://www.xakep.ru/magazine/xa/048/087/1.asp (work with sockec…
cmake_minimum_required(VERSION 2.8.12)
project("test_task")
# library
set(library_root ${CMAKE_CURRENT_SOURCE_DIR}/library)
file(GLOB_RECURSE SRC_Files ${library_root}/*.h ${library_root}/*.c ${library_root}/*.cpp)
add_library(library SHARED ${SRC_Files})
@TheVice
TheVice / .gitignore
Last active May 6, 2019 23:55
glew_generator - tool that take path to glew and glfixes repositories and generate glew snapshot. More described here https://github.com/nigels-com/glew/issues/13#issuecomment-260712955
.vs/
Debug/
Release/
x64/
build/
include/
src/
googletest-release-*/
pugixml-*/
Visual_Studio_*/
@TheVice
TheVice / Attribute.cpp
Last active November 24, 2016 09:54
Sample wtih HTML deserialization - tags, attributes of tag and style attribute
#include "Attribute.h"
namespace Library
{
namespace HTML
{
std::list<std::pair<Entry, Entry>> Attribute::getAttributes(const std::string& aSource, const Entry& aTag)
{
@TheVice
TheVice / Algorithm
Last active December 25, 2016 20:26
Response to some package immediately without press Enter key
Algorithm
Program create class Task. In constructor locate initialization of object StringBuilder and call of method onInput that contain main loop of application.
At begin of onInput method program set variables of class to it initial state: StringBuilder object should not contain any character, two boolean flags that signal of start and end of package should set to off state.
Next “infinity” loop start. Exit provided by standard console command Ctrl+C and also application addition provided exit by pressing Escape key. In this loop any key that do not represent keys from diapason from task test will be ignored. If start or end of package set and signal set to off switch signal to on position. Otherwise signal character will be interpreted as part of package body.
If package complete, in other words both signals set to on, responseToPackage method call. After end of it class members set to its initial states.
At responseToPackage provided validation and response of valid package. Validate provided by meth
@TheVice
TheVice / IsWindowsVersionOrGreater.asm
Last active September 24, 2019 20:05
This is an extension of VersionHelpers.h that come with Visual Studio 2013 and above. As in original manifest file in application should be present for work check of Windows 8.1 and above - https://blogs.msdn.microsoft.com/chuckw/2013/09/10/manifest-madness/ .
; The MIT License (MIT)
; Copyright (c) 2017 https://github.com/TheVice/
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
/*
* The MIT License (MIT)
*
* Copyright (c) 2018 https://github.com/TheVice/
*
*/
using System;
using System.IO;
#if !NET20
@TheVice
TheVice / CMakeLists.txt
Created August 31, 2018 22:52
Fork of "Pluralsight - Direct2D Fundamentals(2012) by Kenny Kerr" created while study. Information and video tutorial - http://www.pluralsight.com/courses/direct2d-fundamentals Author - @kennykerr, http://kennykerr.ca, https://github.com/kennykerr
cmake_minimum_required(VERSION 2.8.12.2)
project("Pluralsight - Direct2D Fundamentals (2012)")
set(READY_TO_BUILD FALSE)
# Request Visual Studio
if(MSVC)
# Request Visual Studio 2012+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 16.0)
@TheVice
TheVice / BuildVistaButtonFactory.cs
Last active November 12, 2018 21:43
Starting from Windows 8 theme of WPF button by default flat. If require Vista theme, a.k.a. Chrome decorator, at Windows 8 and up theme can be apply by next approach.
/*
*
* The MIT License (MIT)
*
* Copyright (c) 2018 https://github.com/TheVice/
*
* As reference used program samples
* BuildButtonFactory from chapter 11 - "Single-Child Elements" of "Applications = Code + Markup" by Charles Petzold (2006) (ISBN 978-0-7356-1957-9)
* and
* ControlTemplateBrowser from chapter 15 - "Control Templates" at "Dissecting Controls" section of