Skip to content

Instantly share code, notes, and snippets.

JohnEstropia / JEProgressView.h
Last active August 6, 2018 09:03
Workaround an annoying bug with iOS 7.1 where custom track and progress images for UIProgressView gets ignored
View JEProgressView.h
// JEProgressView.h
// Created by John Rommel Estropia on 2014/03/11.
// Copyright (c) 2014 John Rommel Estropia.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
phatblat /
Created May 11, 2015 16:53
A quick script to package up an .ipa correctly since `xcodebuild -exportArchive` misses the required SwiftSupport and WatchKitSupport folders
#!/bin/bash -e
# Bundles an iOS app correctly, using the same directory structure that Xcode does when using the export functionality.
brentsimmons / gist:5810992
Last active January 3, 2021 02:22
Detect a tap on a URL inside a UITextView. Note: the rs_links method isn't included -- you'll need something that takes text and returns an array of detected links. This gist just demonstrates walking through the UITextView characters.
View gist:5810992
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;
mtauraso /
Last active February 10, 2021 04:45
TCC Database Script
# This will add lauchd to the list of allowed processes for accessibility access
sudo sqlite3 /Library/Application\ Support/ "INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','/sbin/launchd',1,1,1,NULL)"
# This outputs the rows in the TCC database
sudo sqlite3 /Library/Application\ Support/ 'select * from access'
echo "Restart is required for these changes to take effect"
Tenzer /
Last active March 22, 2022 05:19
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).

jlnquere / UICollectionViewScroll.swift
Last active June 10, 2022 14:25
XCUITests: scroll UICollectionView to find one of it's offscreen UICollectionViewCell by id
View UICollectionViewScroll.swift
// 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 {
mackuba /
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them:

OS X El Capitan

  • split view - two apps side by side on full screen
xenobrain / sat.rb
Last active March 13, 2023 23:13
View sat.rb
# SAT test for arrays of vertices
# * Shapes must be convex
# * Vertices are specified in CCW order
def find_collision_polygon_polygon a, b
k = 0
while k < 2
a_len = a.length
b_len = b.length
amirrajan / winding_number.rb
Created September 24, 2020 18:33
Winding number collision detection in Ruby.
View winding_number.rb
# coding: utf-8
module Geometry
class Points
def initialize array
@array = array
def point_inside? point
return false unless point.inside_rect? rect
winding_number(point) == 0
xenobrain / circles.rb
Last active March 26, 2023 20:52
circles for dragonruby
View circles.rb
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