Skip to content

Instantly share code, notes, and snippets.

template<typename TMenu>
void RegistryMenu::recursiveLoadMenus(TMenu* parent)
{
if (!canLoadMenu)
return;
MU::Menu* menu = NULL;
while (m_reg.getSubKeyCount())
{
auto submenulist = m_reg.getSubKeys();
for(auto iter = submenulist.begin(); iter != submenulist.end(); iter++)
#include <QCoreApplication>
#include <QObject>
#include <QSet>
#include <QDir>
#include <QUuid>
#include <QBetterFileWatcher>
class CreateFileTestCase : public QObject
{
@caetanus
caetanus / qmake.conf
Created August 4, 2013 20:38
wincross
#
# qmake configuration for win32-g++
#
# Written for MinGW
#
# Cross compile example for i686-w64-mingw32-g++:
# configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32-
#
MAKEFILE_GENERATOR = MINGW
@caetanus
caetanus / testsoutupt
Last active December 20, 2015 15:18
tests
⌂⁂ ⮀ ~ ⮁ prj ⮁ QBetterFileWatcher ⮀ develop ⮀ $ ⮀./runTests.sh
Building lib...
Compiling tests
Running Tests
1 Of 4
===============================================
Testing: CreateFilesTestCase
creating 128 files.
received 128 create events.
@caetanus
caetanus / sqrt.py
Created November 13, 2013 16:21
Square root by binary search
import sys
def sqrt(n):
low = 0
high = n
mid = (high - low) / 2.
iter = 0
while abs((mid ** 2) - float(n)) > 0.00001:
@caetanus
caetanus / lambda.cpp
Created November 24, 2013 16:45
lambda test case
#include <iostream>
#include <functional>
using namespace std;
function<int()> lambdaReturner()
{
int c = 7;
c*=4;
return [=]() mutable{
@caetanus
caetanus / variadic.cpp
Created November 24, 2013 16:58
a variadic study case for cpp
#include <iostream>
using namespace std;
template<class Single>
void printItout(Single arg)
{
cout << arg << "\n";
}
@caetanus
caetanus / list_initialization.cpp
Created November 24, 2013 17:04
initializer_list study c++11
#include <iostream>
#include <initializer_list>
using namespace std;
template <class T>
void printItOut(initializer_list<T> args)
{
for(auto v: args)
{
@caetanus
caetanus / shared_pointer.cpp
Created November 24, 2013 22:09
study case for shared_pointers. a shared_ptr<T> will destroy itself when there is no more references to it acting as a garbage collector
#include <iostream>
#include <memory>
using namespace std;
shared_ptr<int> create_new_number()
{
return shared_ptr<int>(new int(90));
}
@caetanus
caetanus / connect.h
Created December 10, 2013 02:08
Qt4 lambda connect
#include <function>
#include <QString>
#include <QObject>
class LambdaConnectorHelper: public QObject
{
Q_OBJECT
LambdaConnectorHelper(QObject *parent, const function<void()> &f)
: QObject(parent), m_lamba(f)
{