Skip to content

Instantly share code, notes, and snippets.

View kylelol's full-sized avatar

Kyle Kirkland kylelol

View GitHub Profile
import Cocoa
struct ImageConstants {
static let gifDelayTime: NSNumber = 2
static let gifLoopCount:NSNumber = 10
}
extension NSImage {
//swift 2.0 translation/adaptation from https://gist.github.com/akisute/1141953
@nvkiet
nvkiet / [Swift]KeepUItableviewStatic
Created August 17, 2014 06:12
Keep uitableview static when inserting rows at the top
private func addListBubbleCellsWithCount(count: Int) {
var contentOffset = self.tableView.contentOffset
UIView.setAnimationsEnabled(false)
var indexPaths = [NSIndexPath]()
var heightForNewRows: CGFloat = 0
for var i = 0; i < count; i++ {
let indexPath = NSIndexPath(forRow: i, inSection: 0)
@akisute
akisute / gist:1141953
Created August 12, 2011 12:41
Create an animated gif file from images in iOS
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')