Skip to content

Instantly share code, notes, and snippets.

View jturcotte's full-sized avatar

Jocelyn Turcotte jturcotte

View GitHub Profile
@jturcotte
jturcotte / gist:1995575
Created March 7, 2012 19:50
QDebug operator<<(QDebug dbg, const TransformationMatrix &m)
QDebug operator<<(QDebug dbg, const TransformationMatrix &m)
{
dbg.nospace() << "TransformationMatrix(" << endl
<< qSetFieldWidth(10)
<< m.m11() << m.m21() << m.m31() << m.m41() << endl
<< m.m12() << m.m22() << m.m32() << m.m42() << endl
<< m.m13() << m.m23() << m.m33() << m.m43() << endl
<< m.m14() << m.m24() << m.m34() << m.m44() << endl
<< qSetFieldWidth(0) << ')';
return dbg.space();
@jturcotte
jturcotte / Default.sublime-theme
Created May 8, 2012 16:35
Darker sublime text sidebar background
[
{
"class": "sidebar_container",
"layer0.tint": [51, 51, 51],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]
},
{
@jturcotte
jturcotte / qmakeBuildOptionsExtractor.py
Created May 14, 2012 18:03
SublimeClang options_script to extract build options for a source file from a list of qmake build directories.
#!/usr/bin/env python
import sys, os.path, fnmatch, re, shlex, subprocess
def searchMakefile(where, visit, recursive):
if not os.path.exists(where):
return False
if recursive:
for root, dirname, filenames in os.walk(where):
for filename in fnmatch.filter(filenames, 'Makefile*'):
if visit(os.path.join(root, filename)):
@jturcotte
jturcotte / gist:3912465
Created October 18, 2012 15:11
Terminator plugin to open paths in Sublime Text
import re
import terminatorlib.plugin as plugin
import subprocess
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['FileURLHandler']
class FileURLHandler(plugin.URLHandler):
capabilities = ['url_handler']
handler_name = 'file_path'
@jturcotte
jturcotte / gist:4986536
Last active August 21, 2019 12:08
WebView download API
/// Current API
WebView {
experimental.onDownloadRequested: {
downloadConnection.target = downloadItem
// expectedLength = downloadItem.expectedContentLength
downloadItem.destinationPath = downloadItem.suggestedFilename
downloadItem.start()
}
}
@jturcotte
jturcotte / gist:8542804
Created January 21, 2014 16:00
Simon's newWindowComponent example
#include <QtQml>
class NewWindowContext : public QQmlContext
{
Q_OBJECT
public:
NewWindowContext(QQmlContext *parentContext)
: QQmlContext(parentContext)
, handle(0)
{}
@jturcotte
jturcotte / PKGBUILD
Created February 26, 2014 10:09
qtwebengine AUR update
# Maintainer: Stefan Damm <autama at nurfuerspam.de>
pkgname=qtwebengine
pkgver=1
pkgrel=4
pkgdesc="A Chromium integration for Qt. (GIT version)"
arch=('x86_64' 'i686')
url="http://qt-project.org/wiki/QtWebEngine"
license=('custom')
makedepends=('elfutils' 'gperf' 'mesa' 'perl-json' 'python2-jinja' 'python2-ply' 'python2-simplejson' 'yasm' 'git' 'openssh' 're2c')
@jturcotte
jturcotte / gist:6e33d74a6abe879011af
Last active August 29, 2015 14:01
QtWebEngine DevTool fix
From c01a0176ec22dbc6df6077abf8408d580f7f9cf7 Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <[email protected]>
Date: Thu, 6 Nov 2014 18:08:59 +0100
Subject: [PATCH] Quick fix of the inspector
Change-Id: Ic00976b537d6a9b4279cf5dfbf33bed32ab0089a
---
src/core/browser_context_qt.cpp | 12 +++-
src/core/browser_context_qt.h | 4 ++
src/core/content_browser_client_qt.cpp | 10 ---
Component {
id: reusableComponent
Item {
property string value: "Hello"
}
}
property Item itemA: reusableComponent.createObject(this)
property Item itemB: reusableComponent.createObject(this)
Text {
@jturcotte
jturcotte / gerrit-submit.py
Created August 12, 2014 12:08
Submit a gerrit patch using it's local SHA1
#!/usr/bin/python
import subprocess
import sys
import re
import json
localCommit = sys.argv[1]
gitShow = subprocess.check_output(['git', 'show', '--no-patch', localCommit])
for line in gitShow.decode().splitlines():