Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
@stephenquan
stephenquan / SortedListModel.qml
Last active April 23, 2019 08:27
SortedListModel.qml
// Implements a convenient ListModel that contains sorted items.
//
// properties:
// sortKey: specifies one or more key to sort on with an optional "-" prefix to set descending order
// compareFunc: allows you to replace the default compare function with your own
//
// methods:
// insertSorted(obj) - uses binary search insertion sort, duplicates aren't allowed, last in wins.
// sort() - leverages from Array.prototype.sort() to rapidly sort all items to a new compareFunc
// load() - load from another model
@stephenquan
stephenquan / appstudio-active-networks.qml
Created May 3, 2018 05:34
appstudio-active-networks.qml
import QtQuick 2.7
import QtQuick.Controls 2.1
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Networking 1.0
Item {
Flickable {
anchors.fill: parent
contentWidth: textArea.width
contentHeight: textArea.height
@stephenquan
stephenquan / psql_demo.sh
Created April 30, 2018 05:08
psql_demo.sh
# Demonstrates psql command line client on Ubuntu machines
# See: https://www.postgresql.org/download/linux/ubuntu/
cat $HOME/.pgpass <<EOF
$PGHOST:5432:$PGINST:$PGUSER:$PGPASS
EOF
psql -h $PGHOST -p 5432 -U $PGUSER $PGINST -t -f - <<EOF
drop table primes;
create table primes (
@stephenquan
stephenquan / node-https-config.js
Last active April 18, 2018 00:32
node-https.js
module.exports = {
port: 8080,
createOptions: {
name: 'Http Server',
version: '1.0.0'
},
bodyParserOptions: {
uploadDir: '/tmp/node_https',
keepExtensions: true
}
@stephenquan
stephenquan / ASUS_WindowsMetrics.reg
Last active December 30, 2022 20:24
menu font too small
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
"BorderWidth"="-15"
"CaptionFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
00,00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"CaptionHeight"="-330"
"CaptionWidth"="-330"
@stephenquan
stephenquan / appstudio-datasource-senddata-sample.qml
Created April 11, 2018 03:04
appstudio-datasource-senddata-sample.qml
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import ArcGIS.AppFramework.Devices 1.0
Item {
property DeviceListModel deviceListModel: discoveryAgent.devices
property Device currentDevice
ColumnLayout {
@stephenquan
stephenquan / hockget.sh
Created April 10, 2018 04:41
hockget.sh
#!/bin/bash
currentDir="$(pwd)"
scriptsDir="$(cd $(dirname $0); pwd)"
datestamp=$(date +%Y%m%d)
function showUsage {
cat <<+
HockInstall.sh -name Name of app
-appId HockeyApp App Id
@stephenquan
stephenquan / appstudio-positionsource-sample.qml
Last active April 6, 2018 05:35
appstudio-positionsource-sample.qml
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import ArcGIS.AppFramework.Devices 1.0
import ArcGIS.AppFramework.Positioning 1.0
Item {
property DeviceListModel deviceListModel: discoveryAgent.devices
property Device currentDevice
property Position currentPosition
@stephenquan
stephenquan / appstudio-nmeasource-sample.qml
Last active April 6, 2018 04:10
appstudio-nmeasource-sample.qml
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import ArcGIS.AppFramework.Devices 1.0
import ArcGIS.AppFramework.Positioning 1.0
Item {
property DeviceListModel deviceListModel: discoveryAgent.devices
property Device currentDevice
@stephenquan
stephenquan / appstudio-devices-sample.qml
Last active April 9, 2018 21:24
appstudio-devices-sample.qml
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import ArcGIS.AppFramework.Devices 1.0
Item {
property DeviceListModel deviceListModel: discoveryAgent.devices
property Device currentDevice
ColumnLayout {