Skip to content

Instantly share code, notes, and snippets.

View robertknight's full-sized avatar

Robert Knight robertknight

View GitHub Profile
@robertknight
robertknight / harvard-with-abstract.csl
Created December 14, 2011 12:17
Harvard Reference Format with Abstract
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
<info>
<title>Harvard Reference Format with Abstract</title>
<id>http://www.mendeley.com/profiles/robert-knight/harvard-with-abstract</id>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
</author>
<category citation-format="author-date"/>
@robertknight
robertknight / mendeleydesktop
Created January 13, 2012 11:37
Mendeley Desktop launcher script with GDB
#!/usr/bin/python
import os
import subprocess
import sys
import platform
# Check if this is a 'generic Linux' build (which could be installed anywhere)
# or an Ubuntu/Debian build (installed to /usr/bin/mendeleydesktop
# with other files in /opt/mendeleydesktop)
@robertknight
robertknight / mendeleydesktop
Created January 17, 2012 12:14
Mendeley Desktop launcher script with --debug option
#!/usr/bin/python
import os
import subprocess
import sys
import platform
# Check if this is a 'generic Linux' build (which could be installed anywhere)
# or an Ubuntu/Debian build (installed to /usr/bin/mendeleydesktop
# with other files in /opt/mendeleydesktop)
# Search term parser from https://gist.github.com/1477730
# Modified to allow periods (and other non-letter chars) in unquoted field values
# and field names.
#
# Helper class to help parse out more advanced saerch terms
# from a form query
#
# Note: all hash keys are downcased, so ID:10 == {'id' => 10}
# you can also access all keys with methods e.g.: terms.id = terms['id'] = 10
# this doesn't work with query as thats reserved for the left-over pieces
@robertknight
robertknight / harvard-sorted.csl
Created April 24, 2012 10:25
Harvard 1 - With Alphabetically Sorted Inline Citations
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
<info>
<title>Sorted Harvard Reference Format</title>
<id>http://citationstyles.org/styles/harvard1-sorted</id>
<link href="http://citationstyles.org/styles/harvard1-sorted" rel="self"/>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
</author>
@robertknight
robertknight / gist:2918736
Created June 12, 2012 17:07
Fix for QTBUG-23205
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 030e31b..0df81a4 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5490,7 +5490,12 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
Q_Q(QWidget);
#ifndef QT_NO_GRAPHICSEFFECT
- if (graphicsEffect && graphicsEffect->isEnabled()) {
+ bool useGraphicsEffect = graphicsEffect && graphicsEffect->isEnabled();
@robertknight
robertknight / gist:3149811
Created July 20, 2012 09:19
Mac FSEvents wrapper
// MacFSEventsWatcher.h
#pragma once
#include "libMendeleyExport.h"
#include <QtCore/QObject>
#include <QtCore/QStringList>
typedef struct __FSEventStream* FSEventStreamRef;
@robertknight
robertknight / gist:4162044
Created November 28, 2012 15:39
Mendeley Mac Word Plugin Tester Script
set mendeleyAppPath to POSIX path of (path to application "Mendeley Desktop")
set wordPluginHelperPath to mendeleyAppPath & "/Contents/MacOS/MendeleyWordPlugin.app/Contents/MacOS/MendeleyWordPlugin"
log wordPluginHelperPath
run application wordPluginHelperPath
@robertknight
robertknight / weblabel.cpp
Created December 11, 2012 19:02
WebLabel src
#include "weblabel.h"
#include <QtWebKit/QWebFrame>
#include <QtWebKit/QWebSettings>
#include <QtGui/QPainter>
WebKitLabel::WebKitLabel(const QString& text, QWidget* parent)
: QFrame(parent)
, m_webPage(new QWebPage(this))
@robertknight
robertknight / gist:4268111
Created December 12, 2012 14:25
Mendeley Desktop 1.7 command line options
Usage: ./Mendeley Desktop [options]
--account [email address] Changes the active Mendeley Web account to [email address]
--help Show this list.
--http Use http instead of https.
--identifiers-only Extract only identifiers (DOI/arXiv/PMID) during metadata extraction from PDFs
--ignore-ssl-errors Ignore SSL negotiation errors.
--log-to-stderr Output logging information to standard error.
--no-style Disable all custom styling.
--password [password or SHA-1 hash] Set the password to log in to Mendeley Web with.