Skip to content

Instantly share code, notes, and snippets.

View leha-bot's full-sized avatar
🐝
"Then" (c). I may be slow to respond, sorry about this.

Alex leha-bot

🐝
"Then" (c). I may be slow to respond, sorry about this.
View GitHub Profile
@Nekrolm
Nekrolm / cpp14_traits.md
Created December 19, 2019 16:10
cpp14_17_traits part1

C++14/17 type_traits (пока нет concepts)

Подходит к концу 2019 год. Уже скоро C++20 станет доступен во всей своей красе. Но совсем не скоро он плотно войдет в мир промышленной разработки (сюда еще даже C++14 не везде дошел).

В С++20 появятся концепции/типажи (concepts) -- долгожданная горсть синтаксического сахара, призванная дать разработчикам возможность писать шаблоны (templates), накладывая ограничения на их параметры так, чтоб потом не было мучительно больно.

Зачем вообще накладывать ограничения?

Допустим, у нас есть такой простенький шаблон

@cristianadam
cristianadam / build_qmake.yml
Last active September 9, 2023 10:56
GitHub Actions Doxygen Qt Creator plugin QMake build matrix
name: QMake Build Matrix
on: [push]
env:
QT_VERSION: 5.14.0
QT_CREATOR_VERSION: 4.11.0
PLUGIN_PRO: doxygen.pro
PLUGIN_NAME: Doxygen
@rossy
rossy / dark-mode.c
Created September 21, 2019 13:14
Windows 10 dark mode
#include <windows.h>
#include <uxtheme.h>
#include <dwmapi.h>
#define DWMWA_USE_IMMERSIVE_DARK_MODE 19
extern IMAGE_DOS_HEADER __ImageBase;
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
struct window {
#include <windows.ui.composition.interop.h>
#include <ShellScalingAPI.h>
#include <DispatcherQueue.h>
#include <winrt/Windows.System.h>
#include <winrt/Windows.UI.Composition.Desktop.h>
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt;
using namespace Windows::UI;
cmake_minimum_required(VERSION 3.13)
project(test)
set(CMAKE_CXX_STANDARD 17)
set(scpm_server_branch "develop")
include(scpm.cmake)
scpm_install(imgui 1.67)
scpm_install(expat R_2_2_5)
add_executable(${PROJECT_NAME} main.cpp)
uniform float time;
uniform vec2 resolution;
uniform float sValue;
out vec4 fragColor;
mat2 rotate(float a)
{
float c = cos(a);
float s = sin(a);
@bagder
bagder / simple-doh.c
Created June 18, 2018 11:40
libcurl example using DOH
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
@iamalbert
iamalbert / README.md
Last active November 30, 2023 22:39
Git skip LFS on local repo

Because GitKraken and SourceTree are FUCKING SLOW for repo with large LFS objects.

Need to completely skip LFS operation when pull/fetch/checkout/...

Skip downloading when clone

GIT_LFS_SKIP_SMUDGE=1 git clone SERVER-REPOSITORY

Skip downloading when fetch/checkout/pull

@berkus
berkus / Lifecycle.java
Created January 24, 2018 15:57
Application Backgrounding And Foregrounding Tracking
// Usually these are added as private fields somewhere in Application class
/**
* Handle application foregrounding.
*/
private final class LifecycleListener implements Application.ActivityLifecycleCallbacks {
private Application application;
LifecycleListener(Application app) {
application = app;
@mbinna
mbinna / effective_modern_cmake.md
Last active April 17, 2025 03:18
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft