Skip to content

Instantly share code, notes, and snippets.

View samvtran's full-sized avatar

Sam Tran samvtran

View GitHub Profile
@samvtran
samvtran / gist:3b11cdb829ea5da9f166591752123816
Last active September 23, 2020 01:40
Emulates Alt-` app window switching on Windows via AutoHotKey
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Helper for cycling windows in an app group
WinMoveBelow(hwnd, hwndBelow) {
; MsgBox, "Set " %hwnd% " and " %hwndBelow%
DllCall("SetWindowPos", "ptr", hwnd, "ptr", hwndBelow
@samvtran
samvtran / sorted.js
Last active September 11, 2015 16:24
Sort by module size in http://webpack.github.io/analyse since the npm module for analyzing didn't work >_<
var a = ["KiB", "bytes"];
Array
.from($('.table tbody tr'))
.map(function(v){
return [$(v).find('td:nth-child(2) code').html(), $(v).find('td:nth-child(3)').html()] })
.sort(function(l,r) {
var partsL = l[1].split(" ");
var partsR=r[1].split(" ");
return a.indexOf(partsL[1]) - a.indexOf(partsR[1]) || ~~partsR[0] - ~~partsL[0] })
.map(function(v) {