Skip to content

Instantly share code, notes, and snippets.

View danieloneill's full-sized avatar

Daniel O'Neill danieloneill

View GitHub Profile
@danieloneill
danieloneill / dbi.js
Created March 29, 2015 21:19
node.js + nodedbi, convenience methods
var dbi = require('nodedbi');
var sql = {
query: function( queryStr, args )
{
var q = this.db.query( queryStr, args );
if( !q )
{
console.log( " *** Query Failed: " + this.db.lastError() );
return false;
@danieloneill
danieloneill / gist:d069be8e02e852008cbd
Created March 29, 2015 22:01
Nodejs + libdbi + paging results
var LibDBI = require('nodedbi');
var db = LibDBI.DBConnection({'type':'mysql', 'dbname':'mysql', 'username':'root'});
function getResultHandle(query, args)
{
var q = db.query(query, args);
if( !q )
{
console.log( "Query error: " + db.lastError() );
TEMPLATE = lib
TARGET = CallbackModel
QT += qml quick
CONFIG += qt plugin
TARGET = $$qtLibraryTarget($$TARGET)
uri = com.foxmoxie.CallbackModel
# Input
SOURCES += \
@danieloneill
danieloneill / PiePart.qml
Created June 25, 2015 17:05
QML Pie (Quick and DIrty)
import QtQuick 2.0
import QtGraphicalEffects 1.0
Item {
id: slicePart
anchors.centerIn: parent
width: 200
height: 200
property real offset: 0.20
@danieloneill
danieloneill / LoadingThrobber.qml
Last active June 22, 2022 02:31
Animated pulser/throbber with QML and Qt 5 (http://youtu.be/xJEtOvezcU0)
import QtQuick 2.0
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
Rectangle {
id: throbber
property color colourLow: '#ee303030'
property color colourHigh: '#aa808080'
property bool running: visible && opacity > 0
diff --git a/libnfc/drivers/acr122_usb.c b/libnfc/drivers/acr122_usb.c
index 8a16920..b3df024 100644
--- a/libnfc/drivers/acr122_usb.c
+++ b/libnfc/drivers/acr122_usb.c
@@ -603,6 +603,7 @@ read:
uint8_t attempted_response = RDR_to_PC_DataBlock;
size_t len;
+ int error, status;
@danieloneill
danieloneill / QMLCheapTree.qml
Created January 6, 2016 08:16
An easy way to lay out out multi-dimensional data Accordion-style using Repeater, Layouts, and ... recursion: http://imgur.com/kHHCIEw
import QtQuick 2.4
import QtQuick.Layouts 1.2
ColumnLayout {
width: 100
height: 62
property variant model: [
{
'label': 'Cash',
@danieloneill
danieloneill / OtherComponent.qml
Created November 22, 2017 07:41
Qml Reloading technique
import QtQuick 2.7
Item {
Loader {
id: multilevelLoader
anchors.fill: parent
property string sourceUrl: 'ThirdComponent.qml'
function reload()
{
source = sourceUrl + '?' + loader.counter;
@danieloneill
danieloneill / BUILDING.md
Created November 3, 2018 13:44
BUILDING.md

Building

To build TwitchOverlay you will need a Qt development environment.

Components required are:

  • Core
  • Widgets
  • QuickWidgets
  • Websockets
  • WebView
@danieloneill
danieloneill / mimetypes.c
Created April 9, 2019 03:42
Parse /etc/mime.types in C, produce a linked-list of all mimetypes and filetype associations.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MIMETYPE_MAX 32768*4
#define MIMETYPE_EXT_MAX_LENGTH 16
#define MIMETYPE_EXT_MAX_COUNT 16
// Linked list of our mimetypes:
struct s_mimetype {