Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
@stephenquan
stephenquan / appstudio-sqlindex-sample.qml
Last active April 5, 2018 01:16
appstudio-sqlindex-sample.qml
// This sample demonstrates how we can programmatically extract the primary key and indexes for a table.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Sql 1.0
Item {
TextArea {
@stephenquan
stephenquan / appstudio-sqldatabase-drivername-sample.qml
Last active April 5, 2018 03:59
appstudio-sqldatabase-drivername-sample.qml
// This sample demonstrates connecting to a variety of different databases using SqlDatabase.
// It makes use of Sql.availableDrivers and SqlDatabase.driverName to present you a list of database types.
// QSQLITE is supported on all platforms (Android, iOS, Windows, macOS, linux)
// QODBC works best on Windows, but, somewhat difficult to work on macOS and Linux.
// QPSQL works best on macOS, but, somewhat difficult to work on Windows and Linux.
// QMYSQL should work okay on Windows, macOS and Linux.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
@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-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 / qt-tableview.qml
Last active April 9, 2018 04:05
qt-tableview.qml
// This sample shows how you can make a QtQuick 1 table have the a QtQuick 2 look and feel
// - Uses custom headerDelegate, rowDelegate, itemDelegate
// - Also shows:
// - how to dynamically create columns
// - make the table "flickable" on Android devices
// - simple "3D" styling with LinearGradient
import QtQuick 2.8
import QtQuick.Controls 1.4
import QtQuick.Controls 2.1
@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 {
@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-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 / 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 / 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 (