Skip to content

Instantly share code, notes, and snippets.

View slchen's full-sized avatar

slchen slchen

  • Taiwan
  • 21:13 - 8h ahead
View GitHub Profile
@UnaNancyOwen
UnaNancyOwen / vcpkg_qtcreator.md
Last active December 21, 2021 18:05
How to use Qt that installed by Vcpkg with Qt Creator

How to use Qt that installed by Vcpkg with Qt Creator

(0) Install Qt using Vcpkg

Vcpkgを使用してQtをインストールする。(e.g. C:\vcpkg)

cd C:\vcpkg
.\vcpkg install qt5:x64-windows
@saccadic
saccadic / cv::Mat to GLTexture
Last active January 18, 2018 04:32
Mat画像をImGuiで表示したときのやつ
void ConvertMatToGL(const cv::Mat& src,GLuint* texID){
if(src.empty() == true)
return;
glDeleteTextures(1, texID);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glGenTextures(1, texID);
glBindTexture(GL_TEXTURE_2D, *texID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active March 6, 2025 16:51
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@tarqd
tarqd / LICENSE.md
Last active November 11, 2021 05:20
Tagged Tuples

The MIT License (MIT)

Copyright (c) 2015 Christopher Tarquini

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 furnished to do so, subject to the following conditions:

@davidzchen
davidzchen / sample-linux.c
Last active January 6, 2025 04:10
Sample C code using the Linux kernel coding style
/*
* Sample file using the Linux kernel coding convention.
*
* https://www.kernel.org/doc/Documentation/CodingStyle
*
* General rules:
* - Indents are tabs and must be 8 spaces wide.
* - Each line must be at most 80 characters long.
* - Use C-style comments.
* - File names should be lower-case.c
@davidzchen
davidzchen / sample-google.c
Last active March 13, 2025 21:03
Sample C code using the Google C++ style guide
// Sample file using the Google C++ coding standard.
//
// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
//
// General rules:
// - Indents are two spaces. No tabs should be used anywhere.
// - Each line must be at most 80 characters long.
// - Comments can be // or /* but // is most commonly used.
// - File names should be lower_case.c or lower-case.c
//
@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

#ifndef ERROR_CODE_HPP_
#define ERROR_CODE_HPP_
// define self error code
namespace base {
enum system_error_t {
kAccessDenied = ERROR_ACCESS_DENIED,
};
class system_category_t : public std::error_category {
@dokinkon
dokinkon / gist:4275597
Created December 13, 2012 10:34
QGraphicsItem to QPixmap
QPixmap GraphicsItem::toPixmap() const
{
if (!scene()) {
qWarning() << "[ControlItem::toPixmap] scene is null.";
return QPixmap();
}
QRectF r = boundingRect();
QPixmap pixmap(r.width(), r.height());
pixmap.fill(QColor(0, 0, 0, 0));