Skip to content

Instantly share code, notes, and snippets.

View Tosainu's full-sized avatar
🌸
ヾ( ╹◡╹ 🌸 )ノ"

Kenta Sato Tosainu

🌸
ヾ( ╹◡╹ 🌸 )ノ"
View GitHub Profile
QT += core gui webkitwidgets
TEMPLATE = app
TARGET = QWebView_html-to-cpp
INCLUDEPATH += .
HEADERS += mainwindow.h jsobj.h
SOURCES += main.cc mainwindow.cc jsobj.cc
CONFIG += c++11
QT += core gui webkitwidgets
TEMPLATE = app
TARGET = QWebView_cpp-to-html
INCLUDEPATH += .
HEADERS += mainwindow.h jsobj.h
SOURCES += main.cc mainwindow.cc jsobj.cc
CONFIG += c++11
@Tosainu
Tosainu / main.cc
Last active August 29, 2015 14:13
QtでJson
#include <QCoreApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QDebug>
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
auto json = QJsonDocument::fromJson(QByteArray(R"(
{
#include <QCoreApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QString>
#include <QDebug>
class JsonValue : public QJsonValue {
public:
JsonValue(QJsonValue&& value) : QJsonValue(value) {}
QT += core gui webkitwidgets
TEMPLATE = app
TARGET = QWebView_exchange-value
INCLUDEPATH += .
HEADERS += mainwindow.h jsobj.h
SOURCES += main.cc mainwindow.cc jsobj.cc
CONFIG += c++11
QT += core gui webkitwidgets
TEMPLATE = app
TARGET = QWebView_dom
INCLUDEPATH += .
HEADERS += mainwindow.h
SOURCES += main.cc mainwindow.cc
CONFIG += c++11
#if !defined HELPER_HPP
#define HELPER_HPP
#include <codecvt>
#include <locale>
#include <string>
namespace helper {
std::string to_string(const std::wstring& src) {
@Tosainu
Tosainu / http_client.cc
Last active January 27, 2023 09:59
[WIP] An asynchronous HTTP client using Boost.Asio's stackful coroutines.
#include <iostream>
#include <istream>
#include <ostream>
#include <boost/asio.hpp>
#include <boost/asio/spawn.hpp>
class client {
public:
client(boost::asio::io_service& io_service, const std::string& server, const std::string& path)
: resolver_(io_service), socket_(io_service) {
#include <iostream>
#include <boost/asio.hpp>
auto main(int argc, char** argv) -> int {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " <ip> <port>" << std::endl;
return 1;
}
boost::asio::io_service io;
@Tosainu
Tosainu / build.bat
Last active March 21, 2016 03:12
Vim build script for Windows.
@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
rem Set Version
set VIM_VER=v7.4.1627
set LUA_VER=5.3.2
set PERL_VER=522
rem Set variables