This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keyTimes = array floats for second [(NSNumber)1.2,(NSNumber)2.0] == 2 frames, 1.2 secs for first frame, 2.0 seconds for second frame | |
- (void) addDiscreteTimedImageAnimation:(NSString *)animationName view:(UIImageView *)imageView images:(NSArray *)images keyTimes:(NSArray *)keyTimes repeatCount:(float)repeatCount onDone:(SEL)callback { | |
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; | |
NSMutableArray *values = [[NSMutableArray alloc] initWithCapacity:[images count]]; | |
NSMutableArray *keyTimesAsPercent = [[NSMutableArray alloc] initWithCapacity:[keyTimes count]]; | |
double totalDuration = 0.0; | |
for(UIImage *image in images) { | |
[values addObject:(id)(image.CGImage)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (int)sinaCountWord:(NSString*)s{ | |
int i,n=[s length],l=0,a=0,b=0; | |
unichar c; | |
for(i=0;i<n;i++){ | |
c=[s characterAtIndex:i]; | |
if(isblank(c)){ | |
b++; | |
}else if(isascii(c)){ | |
a++; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<title>Stay Standalone</title> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<script src="stay_standalone.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<ul> | |
<li><a href="http://google.com/">Remote Link (Google)</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage example: | |
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png | |
// | |
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]]; | |
// .h | |
@interface UIImage (IPImageUtils) | |
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "iChat" | |
on message received message from theBuddy for textChat | |
set whoDidIt to full name of theBuddy | |
set buddyIcon to image of theBuddy | |
tell application "System Events" | |
set frontApp to name of first application process whose frontmost is true | |
end tell | |
tell application frontApp | |
set window_name to name of front window | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define degreesToRadian(x) (M_PI * (x) / 180.0) | |
+ (void)shakyWithLayer:(CALayer *)layer delegate:(id)object forKey:(NSString *)key { | |
CAKeyframeAnimation * animation; | |
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
animation.duration = 0.25; | |
animation.cumulative = YES; | |
animation.repeatCount = 9999; | |
animation.values = [NSArray arrayWithObjects: | |
[NSNumber numberWithFloat: 0.0], | |
[NSNumber numberWithFloat: degreesToRadian(-4.0)], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'fileutils' | |
require 'date' | |
require 'yaml' | |
require 'uri' | |
require 'rexml/document' | |
include REXML | |
doc = Document.new File.new(ARGV[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ARC Helper | |
// | |
// Version 2.2 | |
// | |
// Created by Nick Lockwood on 05/01/2012. | |
// Copyright 2012 Charcoal Design | |
// | |
// Distributed under the permissive zlib license | |
// Get the latest version from here: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
12306 Auto Login => A javascript snippet to help you auto login 12306.com. | |
Copyright (C) 2011 Kevintop | |
Includes jQuery | |
Copyright 2011, John Resig | |
Dual licensed under the MIT or GPL Version 2 licenses. | |
http://jquery.org/license | |
Includes 12306.user.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
OlderNewer