有没有办法在Markdown中创建一个在新窗口中打开的链接?如果没有,您建议使用什么语法来执行此操作.我将它添加到我使用的markdown编译器中.我认为这应该是一种选择.
我在alias
vs. 上发现了一篇博文alias_method
.如该博客文章中给出的示例所示,我只想在同一个类中将方法别名为另一个.我应该使用哪个?我总是看到alias
用过,但有人告诉我alias_method
更好.
别名的用法
class User
def full_name
puts "Johnnie Walker"
end
alias name full_name
end
User.new.name #=>Johnnie Walker
Run Code Online (Sandbox Code Playgroud)
alias_method的用法
class User
def full_name
puts "Johnnie Walker"
end
alias_method :name, :full_name
end
User.new.name #=>Johnnie Walker
Run Code Online (Sandbox Code Playgroud)
我喜欢用来git diff -w
忽略空白差异.但是,我只是注意到它忽略了线条中间的空白差异.我怎么才能忽略行开头(^)或结尾($)的空白差异?
例如,假设x = filename.jpg
我想知道filename
,哪里filename
可以是任何文件名(假设文件名只包含[a-zA-Z0-9-_]以简化.).
我x.substring(0, x.indexOf('.jpg'))
在DZone Snippets上看过,但效果会不会x.substring(0, x.length-4)
更好?因为,length
是一个属性,不进行字符检查,indexOf()
而是一个函数,并进行字符检查.
在iPhone上用于行为驱动开发的最佳技术是什么?什么是一些开源示例项目,证明了这些技术的合理使用?以下是我发现的一些选项:
UI自动化(适用于设备)
可以使用Cucumber(用JavaScript编写)来驱动UI自动化.这将是一个伟大的开源项目.然后,我们可以编写Gherkin来运行UI自动化测试.现在,我只会写Gherkin作为评论.
更新:Zucchini框架似乎融合了Cucumber和UI Automation!:)
旧博客帖子:
弗兰克和iCuke(基于黄瓜会见iPhone谈话)
是否可以在GitHub上将Flash视频嵌入README.md?它没有出现:https://github.com/mattdipasquale/PicSciP
在Rails中,获取连接到服务器的客户端的IP地址的最佳方法是什么?
以下是我发现的两种方法:
request.remote_ip
request.env['HTTP_X_REAL_IP']
Run Code Online (Sandbox Code Playgroud) 如何更新公式?
我跑brew update
.然后,运行brew outdated
,输出:
mongodb (1.4.3-x86_64 < 1.6.5-x86_64)
Run Code Online (Sandbox Code Playgroud)
因此,mongodb
已经过时了.
我该如何升级呢?我只是卸载然后安装?
对于UIScrollView *toScrollView
(这是屏幕的宽度),我想添加一个灰色的底部边框(与iPhone的原生消息应用程序的撰写视图的to-field完全相同).
为了做到这一点,我跟随Cocoa Touch:如何改变UIView的边框颜色和厚度?并使用自定义覆盖顶部边框UINavigationBar
并制作了toScrollView
x坐标-1和宽度322,以便左右边框就在屏幕外.
这看起来很好,但它有点像黑客,我想知道是否有更好的方法来做到这一点.
- (void)viewDidLoad {
[super viewDidLoad];
// Add UINavigationBar *navigationBar at top.
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self action:@selector(cancelAction)];
UINavigationBar *navigationBar = [[UINavigationBar alloc]
initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
navigationBar.items = [NSArray arrayWithObject:self.navigationItem];
// Add UIScrollView *toScrollView below navigationBar.
UIScrollView *toScrollView = [[UIScrollView alloc]
initWithFrame:CGRectMake(-1.0f, 43.0f, 322.0f, 45.0f)];
toScrollView.backgroundColor = [UIColor whiteColor];
toScrollView.layer.borderColor = [UIColor colorWithWhite:0.8f alpha:1.0f].CGColor;
toScrollView.layer.borderWidth = 1.0f;
[self.view addSubview:toScrollView];
[self.view addSubview:navigationBar]; // covers top of toScrollView …
Run Code Online (Sandbox Code Playgroud) alias ×2
git ×2
ios ×2
markdown ×2
border ×1
client ×1
cucumber ×1
diff ×1
embed ×1
flash ×1
formula ×1
github ×1
homebrew ×1
html ×1
hyperlink ×1
ignore ×1
indexof ×1
ip-address ×1
iphone ×1
javascript ×1
new-window ×1
replace ×1
rspec ×1
ruby ×1
substr ×1
substring ×1
target ×1
terminal ×1
uiview ×1
whitespace ×1