This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| func checkSubstrings(str string, subs ...string) (bool, int) { | |
| matches := 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://stackoverflow.com/a/55297349/7670262 | |
| #include <QDebug> | |
| #include <QJsonDocument> | |
| #include <QJsonObject> | |
| #include <QJsonArray> | |
| int main() | |
| { | |
| const auto data = R"({ "Name": "45", "Path": "C:\file.json" })"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <iomanip> | |
| #include <cstdlib> | |
| #include <string> | |
| #include <vector> | |
| #include <array> | |
| #include <utility> | |
| #include <algorithm> | |
| #include <unordered_map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Print progress on same line | |
| (1..10).each do |i| | |
| print "\rDownloaded: #{i} of 10" | |
| sleep 1 | |
| end | |
| puts | |
| puts 'Rest of the logs here...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <fstream> | |
| #include <cstdlib> | |
| #include <rapidjson/document.h> | |
| #include <rapidjson/istreamwrapper.h> | |
| #include <rapidjson/writer.h> | |
| #include <rapidjson/stringbuffer.h> | |
| #include <rapidjson/ostreamwrapper.h> | |
| int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <QObject> | |
| #include <QCoreApplication> | |
| #include <QUdpSocket> | |
| #include <QTimer> | |
| int main( int argc, char *argv[] ) | |
| { | |
| QCoreApplication app( argc, argv ); | |
| QUdpSocket _s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <QCoreApplication> | |
| #include <QUdpSocket> | |
| #include <QObject> | |
| int main(int argc, char *argv[]) | |
| { | |
| QCoreApplication a(argc, argv); | |
| QUdpSocket _s; | |
| _s.bind( QHostAddress::LocalHost, 9000 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <QApplication> | |
| #include <QDebug> | |
| #include <QSystemTrayIcon> | |
| #include <QMenu> | |
| #include <QAction> | |
| #include <QIcon> | |
| #include <QThread> | |
| #include <QObject> | |
| #include <QFile> | |
| #include <QIODevice> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Validate date using regex | |
| // Format: YYYY/MM/DD | |
| #include <iostream> | |
| #include <regex> | |
| bool isDateValid( const std::string& date ) | |
| { | |
| std::regex regexDate { R"(\d{4}/\d{2}/\d{2})" }; | |
| std::smatch match; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ---------------------------------------------- | |
| // List the contents of a directory if changed | |
| // Using QFileSystemWatcher, QDirIterator and | |
| // QEventLoop, and lambda function for connect | |
| // ---------------------------------------------- | |
| #include <QObject> | |
| #include <QEventLoop> | |
| #include <QDebug> | |
| #include <QFileSystemWatcher> |