Skip to content

Instantly share code, notes, and snippets.

@arjunattam
arjunattam / tabs.scpt
Created April 28, 2022 10:21
Open a new Chrome window with Safari tabs from your phone
set newline to {return & linefeed, return, linefeed, character id 8233, character id 8232}
on split_text(the_text, the_delimiter)
set AppleScript's text item delimiters to the_delimiter
set the_text_items to every text item of the_text
set AppleScript's text item delimiters to ""
return the_text_items
end split_text
set the_query to "'select url from cloud_tabs where device_uuid = (select device_uuid from cloud_tab_devices where device_name like \"%iPhone%\")'"

Accessibility testing with Playwright [WIP]

Why

  • native input events

Common issues

  • Unable to read
    • Incorrect screen reader (VoiceOver) behavior
      • Focus landing on wrong element
  • Focus order is incorrect
@arjunattam
arjunattam / redux.test.js
Last active April 5, 2024 21:22
Redux store testing with Playwright
const pw = require('playwright');
(async () => {
const browser = await pw.chromium.launch();
const context = await browser.newContext();
// set addInitScript to run this on every page load in this context
// in the app, use window.IS_PLAYWRIGHT to set window.store = store;
await context.addInitScript('window.IS_PLAYWRIGHT = true;')
@arjunattam
arjunattam / index.html
Last active January 13, 2020 23:48
gistpad-playground
<h1>Testing</h1>
<div id="root">
&nbsp;
</div>
# This script finds vertex ids in an LSIF output file that have been referenced
# in edge declarations (as outV or inV), before being declared as a vertex.
#
# Usage
# To run on lsif.json file:
# $ python validate-lsif.py lsif.json
#
import json
import sys
def encode(data, modelers):
'''
data is a list of vector. each vector
has n elements. modelers is a list of
n functions, for each element of the vector.
'''
encoded = ''
if not data:
@arjunattam
arjunattam / directory-structure
Last active January 6, 2017 05:59
Snippets for building a cordova plugin
HyperTrackWrapper
|-- src
| |-- android
| | |--HyperTrackWrapper.java
| |
| |-- ios
| | |--HyperTrackWrapper.m
|
|-- www
| |-- HyperTrackWrapper.js
@arjunattam
arjunattam / main.m
Last active May 12, 2018 18:32
decode time aware polyline in objective-c
// main.m
#import <Foundation/Foundation.h>
// Main methods declaration
NSArray *getDecodedPolyline(NSString *);
NSArray *getLocationsTillTime(NSArray *, NSDate *);
// Helper methods declaration
NSArray *getDecodedDimensionFromPolyline(NSString *, int);
NSArray *getFormattedDimensions(NSNumber *, NSNumber *, NSNumber *);
from rest_framework.fields import DateTimeField
TIME_CORRECTION_THRESHOLD = 5 * 60 # threshold offset difference in seconds
class TrueDateTimeField(DateTimeField):
'''
Custom DateTimeField that offsets the value during
validation to ensure bad device time is corrected