小编Pat*_*ick的帖子

调整UIView的大小以允许广告单元的空间

我想在UIView的子类上面添加一个广告单元RCTRootView.这将RCTRootView下降约50px.这是我目前的尝试.

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                  moduleName:@"test"
                                               launchOptions:launchOptions];



CGRect frame = rootView.frame;
  frame.size.height -= 50;
  rootView.frame = frame;

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  self.window.autoresizesSubviews = YES;
  UIViewController *rootViewController = [[UIViewController alloc] init];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
Run Code Online (Sandbox Code Playgroud)

这是一个React Native项目,所以使用了StoryBoard.如何调整rootView的大小?

如何在UIView(广告单元)上方的UIWindow中实例化和附加viewController?

objective-c uiview uiwindow ios react-native

18
推荐指数
1
解决办法
348
查看次数

Postgresql和ActiveRecord在哪里:正则表达式匹配

我在正常的正则表达式中创建了这个正则表达式

/(first|last)\s(last|first)/i
Run Code Online (Sandbox Code Playgroud)

它匹配前三个

first last
Last first
First Last
First name
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取full_name与我写的正则表达式匹配的所有记录.我正在使用PostgreSQL

Person.where("full_name ILIKE ?", "%(first|last)%(last|first)%")
Run Code Online (Sandbox Code Playgroud)

这是我的尝试.我也尝试过SIMILAR TO~没有运气

regex postgresql activerecord ruby-on-rails rails-activerecord

15
推荐指数
1
解决办法
1万
查看次数

Gandi.net和Heroku域路由

我的.io域适用于www.domain.io,但不适用于domain.io版本.以下是我尝试过的每个版本和修订版,每个版本和修订版之间有足够的时间.我...

@ 10800 IN A 174.129.212.2
@ 10800 IN A 75.101.145.87
@ 10800 IN A 75.101.163.44
blog 10800 IN CNAME blogs.vip.gandi.net.
imap 10800 IN CNAME access.mail.gandi.net.
pop 10800 IN CNAME access.mail.gandi.net.
smtp 10800 IN CNAME relay.mail.gandi.net.
webmail 10800 IN CNAME webmail.gandi.net.
www 10800 IN CNAME domain.herokuapp.com
@ 10800 IN MX 50 fb.mail.gandi.net.
@ 10800 IN MX 10 spool.mail.gandi.net.

@ 10800 IN A 174.129.212.2
@ 10800 IN A 75.101.145.87
@ 10800 IN A 75.101.163.44
www 10800 IN CNAME domain.herokuapp.com

@ 10800 …
Run Code Online (Sandbox Code Playgroud)

dns heroku

12
推荐指数
2
解决办法
4921
查看次数

如何在Mac上一起安装ffmpeg和一个应用程序?

我在一个文件中为macOS构建和打包了一个电子应用程序.app.该应用程序需要将ffmpeg安装在最终用户的计算机上才能使用.

目前,我不得不在每个最终用户的计算机上手动安装ffmpeg来运行该应用程序.

我想通过一个简单的安装程序在线发布应用程序,用于ffmpeg和应用程序.我见过的.dmg文件允许您.app轻松地将其拖入应用程序文件夹,但在安装过程中仍然没有ffmpeg依赖项.

如何在mac上一起安装ffmpeg和app?

也许包括内容中的ffmpeg构建.app也是一种解决方案.这可能是不可能的,因为相关的问题提到只有ffmpeg CLI的抽象而不是可以直接使用ffmpeg的东西.

macos xcode ffmpeg packagemaker electron

10
推荐指数
1
解决办法
740
查看次数

博客文章的 rss 提要分页网址是什么样的?

我知道要访问您访问的 blogspot 博客的 RSS 提要

blog.blogspot.com/feeds/posts/default
Run Code Online (Sandbox Code Playgroud)

但是如何获得提要的第二页呢?

我知道其他博客使用查询参数?paged=2。是否有类似的查询参数做同样的事情?

url blogspot url-parameters

5
推荐指数
1
解决办法
1321
查看次数

如何实现toString将数字转换为字符串?

在一次采访中,我被要求实现toString()将数字转换为字符串。

toString() n => s 123 => "123"

除了:

  • 通过连接空字符串来转换数字 123+""
  • 使用本机toString()函数 (123).toString()
  • 创建一个新字符串 String(123)

javascript 中还能怎样toString()实现呢?

javascript string numbers tostring

5
推荐指数
1
解决办法
2033
查看次数

RSpec - 无法存根类私有方法

我试图使用RSpec 3来创建一个外部请求某些JSON的方法.我之前将它放在spec_helper.rb文件中,但是现在我重构并将方法移动到它自己的类中,不再存根作品.

RSpec.configure do |config|
  config.before do
    allow(Module::Klass).to receive(:request_url) do
      JSON.parse(File.read(File.expand_path('spec/fixtures/example_data.json')))
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

这个班看起来像这样

module Module
  class Klass

    # public methods calling `request_url`
    ...

    private

    def request_url(url, header = {})
      request = HTTPI::Request.new
      request.url = url
      request.headers = header

      JSON.parse(HTTPI.get(request).body)
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

尽管保持spec_helper.rb相同并试图将存根放在实际规范之前,但仍在进行外部请求.

ruby rspec rspec3

4
推荐指数
1
解决办法
5746
查看次数

Guard Rspec:不推荐使用cli选项,更改为:cmd选项

Guardfile在我的rails应用程序中工作

guard 'rspec', all_after_pass: false, cli: '--drb' do

不工作 Guardfile

guard 'rspec', all_after_pass: false, cmd: '--drb' do

我已bundle exec guard多次打开警卫,但我发现即使我收到此消息 Guard::RSpec DEPRECATION WARNING: The :cli option is deprecated. Please customize the new :cmd option to fit your need. 并进行了适当的更改,:cli是唯一一个使用rspec的人.

终端输出 :cli

01:49:14 - WARN - Guard::RSpec DEPRECATION WARNING: The :cli option is deprecated. Please customize the new :cmd option to fit your need.
01:49:15 - INFO - Guard is using Growl to send notifications.
01:49:15 - INFO …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails guard

3
推荐指数
1
解决办法
1684
查看次数

Rspec未定义的局部变量或方法root_path

我开始使用Rspec,但是当我跑步时bundle exec rspec我得到一个错误

 /spec/requests/pages_spec.rb:20:in `block (2 levels) in <top (required)>': undefined local
 variable or method `root_path' for #<Class:0x00000102e46850> (NameError)
Run Code Online (Sandbox Code Playgroud)

我没有运行Spork或Guard,所以下面的问题不适用

未定义的局部变量或方法`root_path'(Rspec Spork Guard)

我已添加config.include Rails.application.routes.url_helpers到我的spec_helper.rb文件中,但这没有帮助. undefined局部变量或方法`root_path'Hartl的教程第5.3.2节

这里的 pages_spec.rb

require 'spec_helper'                                                                                                                                                       

describe "Pages" do                                                                                                                                                         
  describe "navigation" do                                                                                                                                                  

    def self.it_should_be_on(path_name, value=nil)                                                                                                                          
      before { visit path_name }                                                                                                                                            

      it "should be on #{path_name}" do                                                                                                                                     
        page.should have_link('Home')                                                                                                                                       
        page.should have_link('Inventory')                                                                                                                                  
        page.should have_link('FAQ')                                                                                                                                        
        page.should have_link('About Us')                                                                                                                                   
        page.should have_link('Location')                                                                                                                                   
        page.should have_link('Contact Us')                                                                                                                                 
        # page.should have_link('Login')                                                                                                                                    
      end                                                                                                                                                                   
    end                                                                                                                                                                     

    it_should_be_on root_path                                                                                                                                               
    it_should_be_on faq_path                                                                                                                                                
    it_should_be_on …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails urlhelper ruby-on-rails-4

2
推荐指数
1
解决办法
5266
查看次数