This file contains hidden or 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
| - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { | |
| if(navigationType == UIWebViewNavigationTypeOther ){ | |
| NSString *ts = [request.URL absoluteString]; | |
| if ([ts indexOfString:@"cmd/loadfinish"]>0){ | |
| int scrollHeight = [[aWebView stringByEvaluatingJavaScriptFromString: @"document.body.scrollHeight"] intValue]; //此处为页面真实高度 | |
| return NO; | |
| } | |
| } |
This file contains hidden or 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
| <script language="javascript" type="text/javascript"> | |
| document.onreadystatechange = function(){ | |
| if(document.readyState=="complete") { | |
| // alert(document.readyState); | |
| window.location="/cmd/loadfinish"; | |
| } | |
| } | |
| </script> |
This file contains hidden or 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
| -(void)webViewDidFinishLoad:(UIWebView *)webview { | |
| CGSize size = [[[webview subviews]objectAtIndex:0] contentSize]; | |
| [[[webview subviews]objectAtIndex:0] setScrollEnabled:NO]; | |
| CGRect rc = webview.frame; | |
| rc.size.height = size.height; | |
| webview.frame = rc; | |
| webview.hidden = NO; | |
| UIView *cell = [[webview superview] superview]; | |
| rc = cell.frame; |
This file contains hidden or 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
| class CleanRoom | |
| def run(setups, &block) | |
| setups.each do |setup| | |
| instance_eval &setup | |
| end | |
| instance_eval &block | |
| end | |
| end |
This file contains hidden or 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
| #import "CoreText/CoreText.h" | |
| #import <QuartzCore/QuartzCore.h> | |
| enum GradientType { | |
| LEFT2RIGHT = 1, | |
| TOP2BOTTOM = 2, | |
| RIGHT2LEFT = 3, | |
| BOTTOM2TOP = 4 | |
| }; |
This file contains hidden or 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
| class Dog | |
| def initialize(name) | |
| @name = name | |
| @cans = [] | |
| end | |
| def can(*args) | |
| @cans = args | |
| end |
This file contains hidden or 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
| require 'rubygems' | |
| require 'spork' | |
| #uncomment the following line to use spork with the debugger | |
| #require 'spork/ext/ruby-debug' | |
| unless defined?(Rails) | |
| require File.dirname(__FILE__) + "/../config/environment" | |
| end | |
| Spork.prefork do |
This file contains hidden or 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
| require 'spec_helper' | |
| describe "AuthenticationPages" do | |
| subject {page} | |
| describe "login" do | |
| before {visit login_path} | |
| describe "visit login page" do | |
| it{should have_selector('h1', text:'login')} | |
| end |
This file contains hidden or 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
| require 'spec_helper' | |
| describe User do | |
| subject {@user} | |
| before {@user = User.new(name:'ExampleUser', email:'hah@gmail.com', | |
| password: 'foobar', password_confirmation:'foobar') } | |
| it {should be_valid} | |
| it {should respond_to(:name)} | |
| it {should respond_to(:email)} |
This file contains hidden or 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
| //系统 | |
| NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary]; | |
| NSString* version = [infoDict objectForKey:@"CFBundleVersion"]; | |
| //写入 | |
| NSMutableDictionary* dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ]; | |
| [ dict setObject:@"Yes" forKey:@"RestartSpringBoard" ]; | |
| [ dict writeToFile:@"/Sample.plist" atomically:YES ]; | |
| //读取 |