Skip to content

Instantly share code, notes, and snippets.

Robert Knight robertknight

View GitHub Profile
@robertknight
robertknight / harvard-with-abstract.csl
Created Dec 14, 2011
Harvard Reference Format with Abstract
View harvard-with-abstract.csl
<?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 Jan 13, 2012
Mendeley Desktop launcher script with GDB
View mendeleydesktop
#!/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 Jan 17, 2012
Mendeley Desktop launcher script with --debug option
View mendeleydesktop
#!/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)
View search_terms.rb
# 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 Apr 24, 2012
Harvard 1 - With Alphabetically Sorted Inline Citations
View harvard-sorted.csl
<?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 Jun 12, 2012
Fix for QTBUG-23205
View gist:2918736
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 Jul 20, 2012
Mac FSEvents wrapper
View gist:3149811
// MacFSEventsWatcher.h
#pragma once
#include "libMendeleyExport.h"
#include <QtCore/QObject>
#include <QtCore/QStringList>
typedef struct __FSEventStream* FSEventStreamRef;
@robertknight
robertknight / gist:4162044
Created Nov 28, 2012
Mendeley Mac Word Plugin Tester Script
View gist:4162044
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
View weblabel.cpp
#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 Dec 12, 2012
Mendeley Desktop 1.7 command line options
View gist:4268111
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.
You can’t perform that action at this time.