Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
@stephenquan
stephenquan / Evaluator.qml
Created November 1, 2018 01:29
Evaluator.qml
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Evaluator")
@stephenquan
stephenquan / UpdatePortalItem.sh
Last active November 1, 2018 21:47
UpdatePortalItem.sh
#!/bin/bash -xe
portal_url=https://www.arcgis.com
cache_dir=/tmp/cache
rest_json=${cache_dir}/rest.json
token_json=${cache_dir}/token.json
user_json=${cache_dir}/user.json
content_json=${cache_dir}/content.json
item_json=${cache_dir}/item.json
@stephenquan
stephenquan / qvariant_test.cpp
Created November 28, 2018 11:52
qvariant_test.cpp
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <QObject>
#include <QVariant>
#include <QDebug>
using namespace std;
template <typename A>
function consoleTrace() { console.log(new Error()).stack.split("\n")[1]; }
@stephenquan
stephenquan / appstudio-sql-troubleshooter.qml
Last active January 28, 2019 21:04
appstudio-sql-troubleshooter.qml
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Sql 1.0
Item {
Flickable {
anchors.fill: parent
@stephenquan
stephenquan / sqlce.vbs
Created March 6, 2019 22:02
sqlce.vbs
Option Explicit
Const SQLCE30_CLSID = "Microsoft.SQLSERVER.MOBILE.OLEDB.3.0"
Const SQLCE35_CLSID = "Microsoft.SQLSERVER.CE.OLEDB.3.5"
Const SQLCE40_CLSID = "Microsoft.WINDOWS.SQLLITE.OLEDB.4.0"
REM https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/objectstateenum
Const adStateClosed = 1
Const adStateOpen = 1
Const adStateConnecting = 2
@stephenquan
stephenquan / FormatMessage.h
Last active April 15, 2019 01:41
FormatMessage.h
#ifndef FormatMessage_H
#define FormatMessage_H
class CFormatMessage
{
public:
CFormatMessage(DWORD dwError) :
m_Error(ERROR_SUCCESS),
m_ErrorText(NULL)
{
function head(gen, lines=1) {
return function* () {
let iterator = gen()
while (lines-- > 0)
{
let item = iterator.next()
if (item.done) return true
console.log("head: yield ", item.value)
yield item.value
}
@stephenquan
stephenquan / AppStudio_PromiseAwait.qml
Last active June 24, 2019 05:44
AppStudio_PromiseAwait.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import ArcGIS.AppFramework 1.0
Item {
Button {
text: qsTr("test Promise await")
onClicked: testPromiseAwait()
}
@stephenquan
stephenquan / testPromiseAwait-babel.js
Last active June 23, 2019 20:39
testPromiseAwait-babel.js
function testPromiseAwait() {
_asyncToGenerator(function*() {
try {
console.log(yield download("https://appstudio.arcgis.com"))
console.log(yield download("https://community.esri.com/groups/appstudio"))
console.log(yield download("https://community.esri.com/groups/survey123"))
} catch (err) {
console.log(err)
}
})()