Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
@stephenquan
stephenquan / AppStudio_20190619_SortingCities.qml
Created June 24, 2019 04:48
AppStudio_20190619_SortingCities.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import QtPositioning 5.12
import ArcGIS.AppFramework 1.0
Item {
ColumnLayout {
anchors.fill: parent
anchors.margins: 10 * AppFramework.displayScaleFactor
@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 / cpp_opt_prompt.cpp
Last active November 28, 2022 07:38
cpp_opt_prompt.cpp
bool done = true;
do
{
char Opt[255];
cout << "\nOption: ";
cin >> Opt;
done = true;
switch (Opt[0])
{
case '0':
@stephenquan
stephenquan / sam2.hta
Created November 22, 2022 06:05
sam2.hta
<html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<style>
div.redCross {
display: inline-block;
width: 16px;
height: 16px;
background-image: url(data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20stroke%3D%22red%22%20d%3D%22M23.985%208.722L16.707%2016l7.278%207.278-.707.707L16%2016.707l-7.278%207.278-.707-.707L15.293%2016%208.015%208.722l.707-.707L16%2015.293l7.278-7.278z%22%2F%3E%3C%2Fsvg%3E);
}
@stephenquan
stephenquan / sam.hta
Last active November 22, 2022 05:30
sam.hta
<html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<script>
function svgToDataURL(svg) {
return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg);
//return "data:image/svg+xml;base64," + btoa(svg); // this works too!
//return "data:image/svg+xml;charset=utf-8," + svg; // this only works in modern browsers
}
var assets = {
@stephenquan
stephenquan / InvertedOpacityMask.qml
Last active November 11, 2022 05:22
InvertedOpacityMask.qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import Qt5Compat.GraphicalEffects
Page {
Image {
id: background
anchors.fill: parent
source: "https://i.stack.imgur.com/iuLXK.png"
}
@stephenquan
stephenquan / AppStudio_20190703_DoubleValidatorTest.qml
Last active November 9, 2022 04:52
AppStudio_20190703_DoubleValidatorTest.qml
import QtQuick 2.12
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
Page {
Frame {
width: parent.width
ColumnLayout {
width: parent.width
@stephenquan
stephenquan / oauth2refresh.py
Created December 9, 2021 05:52
oauth2refresh.py
import json, urllib.parse, urllib.request
CLIENT_ID = 'appstudioweb'
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
# Prompt for refresh token
refresh_token = input('Copy and paste refresh_token here: ')
# Obtain token
target = "https://www.arcgis.com/sharing/rest/oauth2/token"
@stephenquan
stephenquan / oauth2login.py
Created December 9, 2021 05:50
oauth2login.py
import json, urllib.parse, urllib.request
CLIENT_ID = 'appstudioweb'
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
# Show OAuth2 dialog and get OAuth2 secret
print('Open a web browser and navigate to:')
print('')
print('https://www.arcgis.com/sharing/rest/oauth2/authorize/?hidecancel=true&client_id=appstudioweb&grant_type=code&response_type=code&expiration=-1&redirect_uri=urn:ietf:wg:oauth:2.0:oob&locale=en')
print('')
@stephenquan
stephenquan / teams_virtual_camera_patch_macos.sh
Last active May 26, 2021 00:44
Microsoft Teams virtual camera patch for macOS
#!/bin/bash -xe
# This script enables virtual camera support on Microsoft Teams for macOS.
# This script may be needed to enable 3rd party virtual camera apps such as
# Snap Camera to be used as a Camera source for Microsoft Teams.
#
# To run apply this patch, do the following steps:
#
# 1. Completely quit Microsoft Teams.
# 2. Open the Terminal app, found in Applications -> Utilities