Skip to content

Instantly share code, notes, and snippets.

View zetavg's full-sized avatar

Pokai Chang zetavg

View GitHub Profile
@zetavg
zetavg / 0_Old Adobe iOS app icons.md
Last active April 30, 2023 17:56
Old Adobe iOS app icons

Old Adobe iOS app icons

Extracted from .ipa files or App Store. Just for those who want it.

@zetavg
zetavg / arc_new_tab_page.scpt
Created November 25, 2022 09:00
Bind this script to a hot key that runs if the active app is Arc. (e.g. BTT)
-- Can change this to your favorite new tab page extension URL, such as "chrome-extension://laookkfknpbbblfpciffpaejjkokdgca/dashboard.html"
set newTabPage to "chrome://new-tab-page/"
tell application "/Applications/Arc.app"
activate
-- tell front window to make new tab at after (get active tab) with properties {URL:"chrome://new-tab-page/"} -- not working
open location newTabPage
repeat
set windowTitle to ""
@zetavg
zetavg / arc-traditional-new-tab.scpt
Last active October 11, 2022 10:02
AppleScript to open a traditional new tab (with a New Tab page) in Arc browser. Bind this script to a shortcut key such as ⌘T or ⌘⇧T in tools like BetterTouchTool for Arc.
-- Can change this to your favorite new tab page extension URL, such as "chrome-extension://laookkfknpbbblfpciffpaejjkokdgca/dashboard.html"
set newTabPage to "chrome://new-tab-page/"
tell application "/Applications/Arc.app"
activate
-- tell front window to make new tab at after (get active tab) with properties {URL:"chrome://new-tab-page/"} -- not working
open location newTabPage
repeat
set windowTitle to ""
@zetavg
zetavg / README.md
Last active November 21, 2024 06:38
Apple Shortcut for creating a long-term (per day) stock chart that can be used as a widget with Charty.

Apple Shortcut: Long-term Stock Chart with Charty

Apple Shortcut for creating a long-term (per day) stock chart that can be used as a widget with Charty.

Requirements

@zetavg
zetavg / install-openjdk.sh
Created November 5, 2021 16:51
Install OpenJDK on macOS
brew install openjdk && echo 'export PATH="$(brew --prefix openjdk)/bin:$PATH"' >> ~/.zshrc
if application "Spotify" is running then
using terms from application "Spotify"
if player state of application "Spotify" is paused then
tell application "Spotify" to play
else
tell application "Spotify" to pause
end if
end using terms from
else
using terms from application "Music"
@zetavg
zetavg / firstrade-to-yahoo-finance-import.js
Last active October 10, 2022 04:25
Script to import Firstrade positions into Yahoo Finance as Portfolio.
/*
* 1. Sign in to Firstrade's positions page (https://invest.firstrade.com/cgi-bin/main#/cgi-bin/acctpositions).
* 2. Open DevTools (Command + Option + i) JS console (Esc), paste the code below. Then stuff will be copied.
* 3. Open a new text file, paste the copied content into it and save it as *.csv.
* 4. Go to the Portfolios page on Yahoo Finance (https://finance.yahoo.com/portfolios), click "Import" and upload the file created on step 3.
* 5. You now have a new portfolio imported from your Firstrade positions data (you might want to rename it).
*/
function getPositionTable() {
async function lookup(word, dictionaryCode = 'american-english', accessKey = window.ACCESS_KEY) {
const response = await fetch(
`https://dictionary.cambridge.org/api/v1/dictionaries/${dictionaryCode}/search/first/?q=${word}&format=xml`,
{
method: 'GET',
headers: { accessKey },
}
);
const json = await response.json();
const parser = new DOMParser();
@zetavg
zetavg / lingvist-scripts.js
Created July 20, 2021 16:32
Some JavaScript script for Lingvist.
function delay(ms = 1000) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
function getCourseIdFromPath() {
try {
const [, id] = window.location.hash.match(/course-wizard\/edit\/([^/]+)/);
return id;
@zetavg
zetavg / copy-gandankit-menu-items.js
Last active May 12, 2020 08:43
需要注意有些 menu item 是被列在「前一天預定」section 裡,可能要把最後那些挑掉。善用 Paste values only 來貼。
function getGanDanKitMenuItems() {
return Array.from(document.querySelectorAll('.promain'))
.map(e => ({
name: e.querySelector('h3').innerText.replace(/(/g, ' (').replace(/)/g, ')'),
price: parseInt(e.querySelector('em').innerText.replace(/[^0-9]/mg, '')),
}))
// Filter out duplicated items
.filter((v, i, arr) => (arr.findIndex(a => a.name === v.name) === i))
}