Skip to content

Instantly share code, notes, and snippets.

View FONQRI's full-sized avatar
๐Ÿ†
Focusing

Behnam Sabaghi FONQRI

๐Ÿ†
Focusing
View GitHub Profile
@FONQRI
FONQRI / define_name_string_with_macro.cpp
Created April 12, 2019 10:33
Define name string with macro and iit it with class name.
#include <boost/type_index.hpp>
#include <iostream>
#define DEFINE_NAME \
std::string name \
{ \
boost::typeindex::type_id<decltype(*this)>().pretty_name() \
};
class Test2
@FONQRI
FONQRI / mongoCustomFunction.js
Last active February 6, 2024 07:48
how to create custom function and use them in mongodb
// use admin database
use admin
// create function
db.system.js.save(
{
_id: "testEchoFunc",
value : function(x) { return x; }
}
)
@FONQRI
FONQRI / downloadVisualstudioCppOnly
Last active October 17, 2018 08:19
download c++ only visual studio 2017
https://docs.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2017
[[ noreturn ]] void f() {
throw "error";
// OK
}
@FONQRI
FONQRI / SendObjectToQml.cpp
Created August 29, 2018 15:14
this is a simple example to show how send an object to qml from a QObject based calss in c++
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQml/QQmlContext>
#include "YourClass.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
class TestClass {
public:
int i;
TestClass() : i(100)