Skip to content

Instantly share code, notes, and snippets.

View anscombe-education.csv
country education income young urban
ME 189 2824 350.7 508
NH 169 3259 345.9 564
VT 230 3072 348.5 322
MA 168 3835 335.3 846
RI 180 3549 327.1 871
CT 193 4256 341 774
NY 261 4151 326.2 856
NJ 214 3954 333.5 889
PA 201 3419 326.2 715
View Go C++.md

Definining data

C++ 11

  std::vector<std::vector<std::string>> fields = {
      {"a", "b"},
      {"c", "d"}
  };  
@vprus
vprus / main.cpp
Created Oct 30, 2015
Exception on double ::get
View main.cpp
#include <QCoreApplication>
#include <QTimer>
#include <QDebug>
#include <QThread>
#define BOOST_THREAD_VERSION 4
#define BOOST_THREAD_PROVIDES_FUTURE 1
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION 1
#define BOOST_THREAD_PROVIDES_EXECUTORS 1
@vprus
vprus / main.cpp
Last active Oct 30, 2015
QFuture on top of boost::future, try 2
View main.cpp
#include <QCoreApplication>
#include <QTimer>
#include <QDebug>
#include <QThread>
#define BOOST_THREAD_VERSION 4
#define BOOST_THREAD_PROVIDES_FUTURE 1
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION 1
#define BOOST_THREAD_PROVIDES_EXECUTORS 1
@vprus
vprus / main.cpp
Created Oct 29, 2015
Qt + boost::future experiment
View main.cpp
#include <QCoreApplication>
#include <QTimer>
#include <QDebug>
#include <QThread>
#define BOOST_THREAD_VERSION 4
#define BOOST_THREAD_PROVIDES_FUTURE 1
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION 1
#define BOOST_THREAD_PROVIDES_EXECUTORS 1
View Image.qml
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
ColumnLayout {
spacing: 0
Image { source: "file:///C:/Build/selection-assets/bugs.jpeg"; height: 10; width: 10; }
@vprus
vprus / main.cpp
Created Sep 28, 2015
QSqlQuery + SQLite not reporting undefined named placeholders
View main.cpp
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QTemporaryFile>
#include <QDebug>
int main(int argc, char *argv[])
@vprus
vprus / Margins.qml
Last active Sep 10, 2015
QML Component that adds a margin around item in layout.
View Margins.qml
import QtQuick 2.0
/* Adds a margin around any item that is meant to be placed into layout.
Instantiate this component with a single children item.
*/
Item {
id: root
property int margins: 0
@vprus
vprus / color.min.js
Last active Sep 9, 2015
Material Colors
View color.min.js
"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(t,e){return this._[t]=e,this},get:function(t){return this._[t]},has:function(t){return t in this._},"delete":function(t){return t in this._&&delete this._[t]},clear:function(){this._=Object.create(null)},get size(){var t=0;for(var e in this._)++t;return t},forEach:function(t){for(var e in this._)t(this._[e],e,this)}}):function(){var t=new Map;t.set(0,0)!==t&&(t=t.set,Map.prototype.set=function(){return t.apply(this,arguments),this})}(),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.color={})}(this,function(t){"use strict";function e(t,e){var s=t-e;return s>180||-180>s?s-360*Math.round(s/360):s}function s(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=j.exec(t))?(e=parseInt(e[1],16),i(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e)):(e=C.exec(t))?r(parseInt(e[1],16)):(e=$.exec(t))?i(e[1],e[2],e[3]):(e=H.exec(t))?i(2.55*e[
View gist:a64cd0ea5a6e17149ad4
#include <QCoreApplication>
#include <QTimer>
struct Test : public QObject
{
void foo() {}
};
int main(int argc, char *argv[])
{