This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1"/> | |
<title>Webpack Bundle Analyzer</title> | |
<!-- viewer.js --> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('visibilitychange', function() { | |
if (document.visibilityState === 'visible') { | |
document.querySelector(':root').style.font = '-apple-system-body'; | |
let fontSize = getComputedStyle(document.body).getPropertyValue('font-size'); | |
console.log(fontSize); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bodyFontToDynamicTypeSize = { | |
"14px": "xSmall", | |
"15px": "Small", | |
"16px": "Medium", | |
"17px": "Large", | |
"19px": "xLarge", | |
"21px": "xxLarge", | |
"23px": "xxxLarge", | |
"28px": "AX1", | |
"33px": "AX2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bodyFontToDynamicTypeSize = { | |
"14px": "xSmall", | |
"15px": "Small", | |
"16px": "Medium", | |
"17px": "Large", | |
"19px": "xLarge", | |
"21px": "xxLarge", | |
"23px": "xxxLarge", | |
"28px": "AX1", | |
"33px": "AX2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from subprocess import check_output, CalledProcessError | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument("port", help="Port Number") | |
parser.add_argument("-n", "--dry-run", action="store_false", help="run without killing processes") | |
args = parser.parse_args() | |
# lsof |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# Copyright (C) 2015 Arthur Yidi | |
# License: BSD Simplified | |
import sys | |
import struct | |
import socket | |
import time | |
from threading import Thread | |
from math import sin, cos | |
from array import array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let keys = [kIOHIDTransportKey, kIOHIDVendorIDKey, kIOHIDVendorIDSourceKey, kIOHIDProductIDKey, kIOHIDVersionNumberKey, kIOHIDManufacturerKey, kIOHIDProductKey, kIOHIDSerialNumberKey, kIOHIDCountryCodeKey, kIOHIDStandardTypeKey, kIOHIDLocationIDKey, kIOHIDDeviceUsageKey, kIOHIDDeviceUsagePageKey, kIOHIDDeviceUsagePairsKey, kIOHIDPrimaryUsageKey, kIOHIDPrimaryUsagePageKey, kIOHIDMaxInputReportSizeKey, kIOHIDMaxOutputReportSizeKey, kIOHIDMaxFeatureReportSizeKey, kIOHIDReportIntervalKey, kIOHIDSampleIntervalKey, kIOHIDBatchIntervalKey, kIOHIDRequestTimeoutKey, kIOHIDReportDescriptorKey, kIOHIDResetKey, kIOHIDKeyboardLanguageKey, kIOHIDAltHandlerIdKey, kIOHIDBuiltInKey, kIOHIDDisplayIntegratedKey, kIOHIDProductIDMaskKey, kIOHIDProductIDArrayKey, kIOHIDPowerOnDelayNSKey, kIOHIDCategoryKey, kIOHIDMaxResponseLatencyKey, kIOHIDUniqueIDKey, kIOHIDPhysicalDeviceUniqueIDKey] | |
for key in keys { | |
if let prop = IOHIDDeviceGetProperty(device, key) { | |
print("\t" + key + ": \(prop)") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch type { | |
case .Null: | |
// system defined events | |
guard let nsEvent = NSEvent(CGEvent: event) else | |
{ print("failed nsvent"); break } | |
print("Null event \(binary(type.rawValue))"); | |
print(nsEvent) | |
break | |
case .KeyDown: print("KeyDown event \(binary(type.rawValue))"); break | |
case .KeyUp: print("KeyUp event \(binary(type.rawValue))"); break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func keyCodeToString(keyCode: CGKeyCode) -> String { | |
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue() | |
let ptr = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData) | |
let keyboardLayoutPtr = UnsafePointer<UCKeyboardLayout>(ptr) | |
var deadKeyState: UInt32 = 0 | |
var actualStringLength = 0 | |
var unicodeString = [UniChar](count: 255, repeatedValue: 0) | |
let status = UCKeyTranslate(keyboardLayoutPtr, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Device Connected \(device.addressString)") | |
let services = device.services?[1] as? IOBluetoothSDPServiceRecord | |
let report = services?.getAttributeDataElement(518)?.getArrayValue() | |
let reportDict = report?[0] as? IOBluetoothSDPDataElement | |
let reportDescriptorElement = reportDict?.getArrayValue()[1] as? IOBluetoothSDPDataElement | |
if let reportDescriptor = reportDescriptorElement?.getDataValue() { | |
var data = [UInt8](count: reportDescriptor.length, repeatedValue: 0) | |
reportDescriptor.getBytes(&data, length: reportDescriptor.length) | |
print(hex(data)) |
NewerOlder