Skip to content

Instantly share code, notes, and snippets.

View PrideChung's full-sized avatar

Pride Chung PrideChung

  • BIGO
  • Guangzhou,China
View GitHub Profile
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@PrideChung
PrideChung / gist:2643180
Created May 9, 2012 09:07
css: limit HTML element's max width/height (compatible with IE6)
<style> selector{ max-width:100px; } </style>
<!--[if IE 6]>
<style>
selector{ _width:expression(this.width>100?(function(dom){dom.style.width='100px';})(this):'auto');} </style>
<![endif]-->
<!-- NOTICE: target element must NOT set width or height attribute, or this doesn't work -->
<!-- I made a Sublime Text snippet, maybe can also use in TextMate -->