##步骤:
- 安装MacVim并用它打开你的源代码
- 选择菜单栏中_Syntax_下的_Convert to HTML_
- 选中新创建的包含HTML的buffer,然后选择_Files » Save_
- 在Safari中打开这个HTML文件( 它与你的源代码在同一个目录下)。你会看见一份完美复制了源代码在MacVim中样式的网页。
- 接下来只需选中Safari中显示的代码并拖拽到Keynote的页面中即可。下面附上一份源代码转换后的HTML样例,你可以将它保存文件后用浏览器打开,便可知道它看起来如何。
<div class="row"> | |
<div class="col-xs-11"> | |
<div class="row"> | |
<div class="col-xs-2"> | |
</div> | |
<div class="col-xs-2"> | |
</div> | |
<div class="col-xs-2"> | |
</div> | |
<div class="col-xs-2"> |
##步骤:
curl -XPOST -H "Content-Type: application/json" -d '{"document": {}}' http://127.0.0.1:3000/documents/search.xls -v |
Rule of thumb:
Rails by default prints datetime in ISO8601 format in %Y-%m-%d %H:%M:%S +offset
style, e.g. 2014-12-18 13:00:00 +1000
and encode datetime in JSON as standard_son_format, e.g. 2005-02-01T05:15:10.000-10:00
Angular formats datetime in timezone of the browser if timezone option of date filter is not specified.
Browsers format datetime string based on local date format settings. But browsers only support datetime-local picker.
With Rails datetime_local_field, the timezone is ignored, it outputs something like this ``.
[[_session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
if (!error) { | |
NSHTTPURLResponse *httpResp = (NSHTTPURLResponse*) response; | |
if (httpResp.statusCode == 200) { | |
// 3 | |
NSString *text = | |
[[NSString alloc]initWithData:data | |
encoding:NSUTF8StringEncoding]; | |
dispatch_async(dispatch_get_main_queue(), ^{ |
public class Solution { | |
public static void main(String [] args){ | |
int [] array = {15, 4, 8, 10, 21, 3, 7, 6, 2}; | |
// 1. sort the first nth items | |
int [] sortedItems; | |
sortItems(array, sortedItems, 3); | |
// 2. compare next item with the nth items | |
// if it's larger than any of the item, replace the item | |
for (int n=3; n<array.length; n++){ | |
for (int i=0; i<3; i++){ |
new_state = root_reducer(old_state, action); |
rspec-rails doesn't require 'rspec-core' intensionally.
So without the 'rspec' command, 'rspec-core' is not required anywhere.
When using RSpec with Cucumber (which doesn't invoke the 'rspec' command'), we need to add 'rspec-expectations' and 'rspec-core' in Gemfile, so that bundler will auto-require them into Rails environment.
Why add a gem in Gemfile if it's already dependented by another gem? Being dependented only get it being installed, but not required. It's the depending gem's responsiblity to require the depedented gem. In this case, though 'rspec-rails' depends on 'rspec-core', it doesn't require 'rspec-core' in code (as explained above). So we need to add them to Gemfile, or require them explicitly somewhere in the codebase.
So if If you want to use rspec-core, you need to add it to your Gemfile. Cucumber will automatically load rspec-core's methods to be available in your step definitions. https://github.com/cucumber/cucumber/wiki/RSpec-Expectations
naive sort
?lvl=27&code=c11:4f0;c12:4f0;c13:10f0;r11:7f1;c11:8f2;b11:9f2;b12:6f3;p12:7f0;c12:8f3;p12:9f3;c13:7f0;c13:9f2;r14:6f2;p14:7f1;c14:8f1;p14:9f2;b14:10f1;c15:6f2;b15:7f0;r15:9f3;c15:10f3;c16:6f3;c16:7f3;c16:8f3;c16:9f0;q12:10f0;c15:11f0;c14:11f0;c13:11f1;c11:5f2;c12:5f2;c13:5f2;c14:5f3;c11:6f1;c10:4f3;c10:5f3;c10:6f3;c10:7f3;g10:8f2;
bubble sort
?lvl=27&code=c9:7f1;c9:8f1;c9:9f1;c9:10f1;c9:11f1;b10:9f0;b10:10f0;r10:11f0;b11:9f0;p11:10f0;b11:11f0;c12:9f3;p12:10f3;r13:9f2;p13:10f2;b13:11f2;r14:9f2;r14:10f2;r14:11f2;c15:7f1;c15:8f1;c15:9f1;c15:10f1;c15:11f1;c10:7f3;c10:8f2;b11:7f3;c11:8f2;p12:7f3;c12:8f3;r13:7f3;c13:8f0;c10:6f3;c9:6f1;c15:6f1;g12:4f2;c13:4f3;c14:4f0;c15:4f0;c15:5f1;c13:5f0;q11:5f0;c12:5f0;c11:4f3;c10:4f2;c9:4f2;c9:5f1;g11:6f2;c12:6f3;c10:5f3;