This file contains 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
/* 1 */ | |
template<template <size_t> class T, size_t... Indices> struct summa; | |
template<template <size_t> class T, size_t Index, size_t... Indices> | |
struct summa<T, Index, Indices...> | |
{ | |
static const decltype(T<Index>::value) value; | |
}; |
This file contains 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
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var me = this; | |
function replacer4Array(a) { | |
return me.replace(/{(\d+)}/g, function(match, number) { | |
var n = parseInt(number, 10); | |
if (isNaN(n) || typeof a[n - 1] === "undefined") { | |
return match; |
This file contains 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
QWebView *MuWebView::createWindow(QWebPage::WebWindowType type) { | |
Q_UNUSED(type) | |
QWebView* webView = new QWebView; | |
QWebPage* webPage = new QWebPage(webView); | |
webView->setWindowModality(Qt::ApplicationModal); | |
webView->setAttribute(Qt::WA_DeleteOnClose, true); | |
webView->setPage(webPage); |
This file contains 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 <fstream> | |
#include <vector> | |
#include <chrono> | |
#include <utility> | |
#include <cmath> | |
const size_t records_number = 1000000; | |
const size_t check_status_chunk_size = records_number / 100; |
This file contains 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
import std.stdio; | |
import std.net.curl; | |
import std.regex; | |
import std.conv; | |
version(Windows) { | |
import std.windows.charset; | |
} | |
This file contains 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
QLineEdit[hasErrorData=true] { | |
border-radius: 6px; | |
border: 2px solid #9A4745; | |
} | |
… | |
ui->adminLoginEdit->setProperty("hasErrorData", "true"); |
This file contains 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
object StringUtils { | |
implicit class StringImprovements(val s: String) { | |
import scala.util.control.Exception._ | |
def toIntOpt = catching(classOf[NumberFormatException]) opt s.toInt | |
def toLongOpt = catching(classOf[NumberFormatException]) opt s.toLong | |
} | |
} |
This file contains 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
void TERPConnector::asyncRequest(const QString &url, const QString &requestData, const QString &successfulDataType, std::function<void(QJsonObject)> onSuccess, | |
std::function<void(QJsonObject)> onError, std::function<void(QJsonObject)> onTimeout, int requestTimeout) { | |
QSharedPointer<QNetworkAccessManager> nam = QSharedPointer<QNetworkAccessManager>(new QNetworkAccessManager); | |
QUrl requestUrl(url_.toString() + url); | |
if (nam | |
/*&& nam_->networkAccessible() == QNetworkAccessManager::Accessible*/) { | |
#ifdef DEBUG | |
qDebug() << "asyncRequest: url = " << requestUrl.toString() << ", data = " << requestData << ", succDataType = " << successfulDataType | |
<< ", requestTimeout = " << requestTimeout; |
This file contains 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
const QString vsrc = R"SHADER( | |
#include "shaders/shader.glsl" | |
)SHADER"; |
This file contains 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
import shapeless._ | |
// A pair of ordinary case classes ... | |
case class Address(street : String, city : String, postcode : String) | |
case class Person(name : String, age : Int, address : Address) | |
// Some lenses over Person/Address ... | |
val nameLens = lens[Person] >> 'name | |
val ageLens = lens[Person] >> 'age | |
val addressLens = lens[Person] >> 'address |
OlderNewer