Skip to content

Instantly share code, notes, and snippets.

/*
* truncatable 1.2.1 - jQuery lightwieght text truncation plugin
*
* Copyright (c) 2009 Philip Beel (http://www.theodin.co.uk/) - modified by Arkadiusz Holko - http://holko.pl
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Revision: $Id: jquery.truncatable.js 2010-07-27 $
*
*/
# filename: config/locales/pl.rb
# taken from: http://github.com/svenfuchs/i18n/blob/4d8e2e3b8ce9841542cc3cf4d33b7a7702b2abc1/test/test_data/locales/plurals.rb
{:pl => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) && ![22, 23, 24].include?(n % 100) ? :few : :other } } } } }
@fastred
fastred / gist:4fd2b6b98d5d2685bf88
Created May 28, 2014 17:09
Centering title label in AHKActionSheet
NSMutableParagraphStyle *paragraph = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
paragraph.alignment = NSTextAlignmentCenter;
actionSheet.titleTextAttributes = @{ NSParagraphStyleAttributeName : [paragraph copy],
NSFontAttributeName : [UIFont systemFontOfSize:14.0f],
NSForegroundColorAttributeName : [UIColor grayColor] };
@fastred
fastred / 1.m
Last active March 15, 2019 13:58
Use UIPanGestureRecognizer instead of UIScreenEdgePanGestureRecognizer
// it's just a proof of concept; there are known problems with this solution
- (void)addPanGestureForPopTransitioning
{
UINavigationController *navigationController = self.navigationController;
NSArray *targets = [navigationController.interactivePopGestureRecognizer valueForKey:@"_targets"];
if ([targets isKindOfClass:[NSArray class]]) {
@try {
id interactivePanTarget = [[targets firstObject] valueForKey:@"target"];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:interactivePanTarget action:NSSelectorFromString(@"handleNavigationTransition:")];
[navigationController.view addGestureRecognizer:panRecognizer];
curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g' | xargs -n1 wget -N
@fastred
fastred / gist:96f3829ed676ed599aeb
Last active August 29, 2015 14:03
NSProgress.markdown

Cleaned up results of running ack NSProgress ./ in

  • /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks
  • /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks

iOS:

CoreData.framework/Headers/NSPersistentStoreResult.h:10:@class NSProgress;
CoreData.framework/Headers/NSPersistentStoreResult.h:33:    NSProgress* _requestProgress;
CoreData.framework/Headers/NSPersistentStoreResult.h:42:@property (strong, readonly) NSProgress* progress;
@fastred
fastred / response.md
Last active August 29, 2015 14:04
My response to https://twitter.com/ericasadun/status/490180083827503104, i.e. why the iPhone has a compact horizontal size class in a landscape orientation

And size class deals with, on a coarse level, the available space that your application has and can therefore make decisions about what its structure should be.

...

So, a size class is all about informing your application of the available space in some coarse way that you can make decisions about how you would substantially alter the application's structure.

—Bruce D. Nilo, Session 214, WWDC 2014

Based on the above citation I assume, that Apple decided there are different horizontal and vertical tresholds of sizes that influence the application's structure:

@fastred
fastred / NS_SWIFT_UNAVAILABLE.md
Last active February 6, 2022 15:35
NS_SWIFT_UNAVAILABLE

Results of searching for NS_SWIFT_UNAVAILABLE macro in iOS 9 and OS X 10.11 headers reveal some new Swift-specific APIs.

Highlights

GameplayKit.framework/Headers/GKEntity.h
70: - (nullable GKComponent *)componentForClass:(Class)componentClass
NS_SWIFT_UNAVAILABLE("Exposed in Swift as componentForClass<ComponentType: GKComponent>(componentClass: ComponentType.Type) -> ComponentType?");

GameplayKit.framework/Headers/GKStateMachine.h
@fastred
fastred / NS_REFINED_FOR_SWIFT.md
Last active June 21, 2016 13:35
NS_REFINED_FOR_SWIFT

Results of searching for NS_REFINED_FOR_SWIFT in the headers.

Foundation.framework/Headers/NSCoder.h

#if !defined(SWIFT_CLASS_EXTRA) || (defined(SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH) && SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH >= 5)
- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0) NS_REFINED_FOR_SWIFT;
#else
- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0);
#endif
//
// UILabel+JumpingDots.swift
// JumpingDots
//
// Copyright (c) 2016 Arkadiusz Holko. All rights reserved.
//
import UIKit
import ObjectiveC