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 / calculator.py
Last active April 21, 2022 09:35
A python3 calculator in one line
print(eval(input('Please enter your arithmetic expression :' )))
@FONQRI
FONQRI / CMakeLists.txt
Created December 28, 2017 21:20
this is a cmakeList.txt file that contain all qt modules .
#cmake file version 1.0
#author behnam sabaghi
#update time 29 / 12 / 2017
cmake_minimum_required(VERSION 2.8)
PROJECT(ProjectName)
set(CMAKE_PREFIX_PATH "$ENV{QTDIR}")
@FONQRI
FONQRI / simpleVectors.cpp
Created December 30, 2017 08:05
this is a simple vector code
#include <memory>
#include <vector>
class Test {
public:
Test() { std::clog << "created" << std::endl; }
~Test() { std::clog << "destroid " << std::endl; }
int value = 56;
};
int main()
@FONQRI
FONQRI / StaticFactoryDesignPattern.cpp
Created December 30, 2017 11:43
Static Factory Design Pattern
#include <iostream>
#include <string>
using namespace std;
// Abstract Base Class
class Shape {
public:
virtual void Draw() = 0;
virtual ~Shape();
@FONQRI
FONQRI / AbstractFactory.cpp
Created December 30, 2017 11:47
Abstract Factory
#include <iostream>
#include <string>
using namespace std;
// Abstract base class
class Mobile {
public:
virtual ~Mobile();
virtual string Camera() = 0;
@FONQRI
FONQRI / C++ObserverPattern‌Base.cpp
Created December 30, 2017 12:18
C++ Observer Pattern‌ Base
#include <iostream>
#include <set>
using namespace std;
// ---------------- Observer interface -----------------
class MyObserver {
public:
virtual void Notify() = 0;
};
@FONQRI
FONQRI / TemplateDesignPattern.cpp
Created December 30, 2017 14:05
template design pattern c++
#include <iostream>
using namespace std;
// Base class
// Template class
class Account {
public:
// Abstract Methods
virtual ~Account();
@FONQRI
FONQRI / ChainOfResponsibilityDesignPattern.cpp
Created December 31, 2017 16:44
Chain of Responsibility
#include <iostream>
using namespace std;
// STATES
enum ErrorStates { ANALYZE = 0, FIX, VERIFY, CLOSE };
// Command Class
class ErrorReport {
private:
@FONQRI
FONQRI / CommandDesignPattern.cpp
Created December 31, 2017 21:37
Command Design Pattern in c++ simple example
#include <iostream>
#include <vector>
using namespace std;
// Command interface
class Command {
public:
virtual ~Command();
virtual void execute() = 0;
};
@FONQRI
FONQRI / AdapterDesignPattern.cpp
Created December 31, 2017 22:44
C++ Adapter Design Pattern
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <list>
#include <memory>
using namespace std;
// Legacy account
class LegacyAccount {
int no;