Skip to content

Instantly share code, notes, and snippets.

@jlnquere
jlnquere / UICollectionViewScroll.swift
Last active June 10, 2022 14:25
XCUITests: scroll UICollectionView to find one of it's offscreen UICollectionViewCell by id
// Thanks to @MonsieurDart for the idea :)
func scroll(collectionView:XCUIElement, toFindCellWithId identifier:String) -> XCUIElement? {
guard collectionView.elementType == .collectionView else {
fatalError("XCUIElement is not a collectionView.")
}
var reachedTheEnd = false
var allVisibleElements = [String]()
while !reachedTheEnd {
@Tenzer
Tenzer / 000-README.md
Last active January 18, 2024 07:02
LastPass Pwned Passwords checker

LastPass Pwned Passwords checker

This is a script for checking if any of the passwords you have stored in LastPass have been exposed through previous data breaches.

To use the script you need to have Python 3 installed and you need a CSV export of your LastPass vault. The export can be generated from the LastPass CLI with:

lpass export > lastpass.csv

or can be extracted with the browser plugin by going to the LastPass icon → More Options → Advanced → Export → LastPass CSV File (note that I did have problems getting this to work).

@yogthos
yogthos / clojure-beginner.md
Last active April 29, 2024 10:56
Clojure beginner resources

Introductory resources

@amirrajan
amirrajan / winding_number.rb
Created September 24, 2020 18:33
Winding number collision detection in Ruby.
# coding: utf-8
module Geometry
class Points
def initialize array
@array = array
end
def point_inside? point
return false unless point.inside_rect? rect
winding_number(point) == 0
@xenobrain
xenobrain / sat.rb
Last active September 25, 2023 16:09
SAT
def create_vertices rect
x = rect.x; y = rect.y
w = rect.w; h = rect.h
cx = x + w * 0.5; cy = y + h * 0.5
sin = Math.sin (rect.angle || 0.0).to_radians; cos = Math.cos (rect.angle || 0.0).to_radians
[
[(x - cx) * cos - (y + h - cy) * sin + cx, (x - cx) * sin + (y + h - cy) * cos + cy], # Top Left
[(x + w - cx) * cos - (y + h - cy) * sin + cx, (x + w - cx) * sin + (y + h - cy) * cos + cy], # Top Right
[(x + w - cx) * cos - (y - cy) * sin + cx, (x + w - cx) * sin + (y - cy) * cos + cy], # Bottom Right
[(x - cx) * cos - (y - cy) * sin + cx, (x - cx) * sin + (y - cy) * cos + cy] # Bottom Left
@xenobrain
xenobrain / circles.rb
Last active October 12, 2023 14:42
circles for dragonruby
module GTK
class Runtime
def draw_circle c
radius = c.radius.to_i || 0
xc = c.x.to_i + radius
yc = c.y.to_i + radius
t = c.thickness || 1
r = c.r || 0
g = c.g || 0
b = c.b || 0