Skip to content

Instantly share code, notes, and snippets.

View username0x0a's full-sized avatar
🐡
πŸ™‰ πŸ™ˆ πŸ™Š

Michal Zelinka username0x0a

🐡
πŸ™‰ πŸ™ˆ πŸ™Š
View GitHub Profile
@krid78
krid78 / AllWindowsToScreen
Created January 30, 2013 13:04
This Script places All windows within the screen bounds
-- Found at: http://hints.macworld.com/article.php?story=2007102012424539
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {"loginwindow", "talagent", "Dock", "SystemUIServer", "SIMBL Agent", "AFSBackgrounder", "NotificationCenter", "iTunesHelper", "PhotoStreamAgent", "com.apple.dock.extra", "WebProcess", "AppleSpell", "com.apple.qtkitserver", "SophosUIServer", "PTPCamera", "Image Capture Extension", "mdworker", "System Events"}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
@mmdumi
mmdumi / EncodePolyline
Created November 2, 2012 09:09
Encode polyline. Google Maps API v3 algorithm. Objective c.
+ (NSString *)encodeStringWithCoordinates:(NSArray *)coordinates
{
NSMutableString *encodedString = [NSMutableString string];
int val = 0;
int value = 0;
CLLocationCoordinate2D prevCoordinate = CLLocationCoordinate2DMake(0, 0);
for (NSValue *coordinateValue in coordinates) {
CLLocationCoordinate2D coordinate = [coordinateValue MKCoordinateValue];
@andrey-krivobok
andrey-krivobok / UIWebView remote debug
Created October 10, 2012 11:15
Enabling remote debugging in a UIWebView
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...Snipped...
[NSClassFromString(@"WebView") _enableRemoteInspector];
// ...Snipped...
}
And connect in Safari to localhost:9999
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active May 13, 2025 05:15
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@saetia
saetia / gist:1623487
Last active April 20, 2025 23:05
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@steipete
steipete / gist:1397553
Created November 27, 2011 13:28
Ugly as hell workaround for UIWebView crashing on non-main thread dealloc (inside a UIView)
- (void)dealloc {
webView_.delegate = nil; // delegate is self here, so first set to nil before call stopLoading.
[webView_ stopLoading];
// UIWebView must be released in the main thread, or we get:
// Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
// This is less evil than the proposed http://stackoverflow.com/questions/945082/uiwebview-in-multithread-viewcontroller
// Calling removeFromSuperview in a dealloc is ugly and evil, but else UIView has a strong reference to UIWebView and our main-release call would be irrelevant.
if (![NSThread isMainThread]) {
[webView_ performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <[email protected]>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate