Skip to content

Instantly share code, notes, and snippets.

@vprus
vprus / gist:8860225
Created February 7, 2014 10:19
Pebble normal vs. text layers
#include <pebble.h>
#include <pebble_fonts.h>
static Window *window;
static Layer *left;
static TextLayer *right;
static GFont font;
static void draw_left(Layer *layer, GContext *ctx) {
@vprus
vprus / README.md
Last active August 29, 2015 14:03
Rectangles in SVG

Example of using half-pixel coordinates with SVG.

@vprus
vprus / gist:a38931b8f380bcf51669
Created August 27, 2014 06:17
Example of post-install action in Boost.Build
import notfile ;
exe hello : hello.cpp ;
notfile install : @postinstall : install-really ;
install install-really : hello : <location>dist ;
explicit install-really ;
actions postinstall
{
@vprus
vprus / boost.diff
Created February 19, 2015 08:47
global address-model and architecutre
diff --git a/Jamroot b/Jamroot
index d1b3c3a..779fe54 100644
--- a/Jamroot
+++ b/Jamroot
@@ -136,6 +136,8 @@ constant BOOST_JAMROOT_MODULE : $(__name__) ;
boostcpp.set-version $(BOOST_VERSION) ;
+use-project /boost/architecture : libs/config/checks/architecture ;
+
@vprus
vprus / gist:282346f73b4d4e9f759e
Created July 9, 2015 10:20
C++11 result_of_t
#include <type_traits>
#include <iostream>
struct S {
int operator()(int) { return 1; }
};
int normal(int) { return 1;}
#include <QCoreApplication>
#include <QTimer>
struct Test : public QObject
{
void foo() {}
};
int main(int argc, char *argv[])
{
@vprus
vprus / color.min.js
Last active September 9, 2015 09:40
Material Colors
"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[
@vprus
vprus / main.cpp
Created September 28, 2015 08:23
QSqlQuery + SQLite not reporting undefined named placeholders
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QTemporaryFile>
#include <QDebug>
int main(int argc, char *argv[])
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 October 29, 2015 09:04
Qt + boost::future experiment
#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