Mac OSX Lion 10.7.
为了解决奇怪的环境问题(自制软件没有安装wget,我有各种奇怪的块和错误),我卸载了zschrc和homebrew以及其他一些东西,然后安装了fish shell.
现在,每当我尝试向/从github推送/拉出时,我都会收到此错误:
The authenticity of host 'github.com (204.232.175.90)' can't be established.
RSA key fingerprint is <string of colon-separated chars that I should probs keep private>.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/Users/sasha/.ssh/known_hosts).
Run Code Online (Sandbox Code Playgroud)
所以我试着检查我的〜./ ssh文件夹的权限,并得到了这个,这对我来说很好看:
-rw-r--r-- 1 sasha staff 97B Jul 9 22:56 config
-rw------- 1 sasha staff 1.7K May 16 2012 id_rsa
-rw-r--r-- 1 sasha staff 403B May 16 2012 …
Run Code Online (Sandbox Code Playgroud) 我正试图使用Lodash去抖动函数,虽然它正在调用函数,但它似乎根本没有去抖动它.我的问题似乎与我在其他地方在SO或Google 上看到的错误一样(通常,他们没有调用_.debounce
返回的函数).
我目前的超级简单实现如下(在Angular with CoffeeScript中):
s.search = -> _.debounce( s._makeSearchRequest, 1000 )()
s._makeSearchRequest = -> console.log("making search request")
Run Code Online (Sandbox Code Playgroud)
在JS中,我相信:
s.search = function() { _.debounce( s._makeSearchRequest, 1000 )() }
s._makeSearchRequest = function() { console.log("making search request") }
Run Code Online (Sandbox Code Playgroud)
我s.search()
通过在输入框中输入来运行,如果我很快输入乱码,控制台会在每次按键时打印出"发出搜索请求",这样每秒多次 - 表示它根本没有被去抖动.
我有什么想法我做错了吗?
我正在使用React Native构建一个iOS应用程序,并尝试在手机上测试它.
如果我将手机插入计算机并直接"构建"到手机,该应用程序正确构建并正确打开/运行,没问题.
但是,如果我尝试将其存档并使用iTunes Connect的TestFlight或Fabric with Crashlytics将其发送到手机,则应用程序会在打开时立即崩溃.它简要地显示了启动屏幕,但没有更多.
此外,没有崩溃报告 - 在TestFlight,Crashlytics或XCode中,一旦我重新插入手机.所以我在黑暗中操作,没有任何关于什么破坏的信息.一直无法在网上找到类似的问题,所以我想我只是问.什么想法可能会出错?
如果您可能需要查看任何代码或其他数据,请与我们联系.其中一些是保密的,但我会尝试发布一个近似版本.
我正在尝试从sqlite3切换到PostgreSQL以便在Rails中进行开发,这样我就没有任何heroku问题.我正在按照heroku和链接到Railscast的建议,但是在安装postgresql后我遇到了以下错误.
在/ usr/local/var/postgres/base/1中创建template1数据库...
致命:无法创建共享内存段:无法分配内存
详细信息:失败的系统调用是shmget(key = 1,size = 2072576,03600).
提示:此错误通常意味着PostgreSQL对共享内存段的请求超出了可用内存或交换空间,或超出了内核的SHMALL参数.您可以减小请求大小,也可以使用更大的SHMALL重新配置内核.要减少请求大小(当前为2072576字节),可以通过减少shared_buffers或max_connections来减少PostgreSQL的共享内存使用量.
我已经开始讨论这个问题了,但我是新手,对内存和数据库的工作原理知之甚少,而且我认为这里的某个人可能能够指出我的方向比我能做得好得多自己找.知道如何解决这个问题吗?我的计算机是新的,相对花哨,如果内存耗尽,我会感到惊讶,所以我不知道减少"共享内存使用"是否是正确的想法(如果我理解发生了什么) .
编辑:应该早点提出来.这是导致错误的命令(构建数据库):
initdb /usr/local/var/postgres -E utf8
Run Code Online (Sandbox Code Playgroud) 我的基本功能规格在本地传递正常但在CircleCI和Codeship上失败.失败的测试:
require 'spec_helper'
describe 'Authentication' do
describe "sign in" do
it "is the landing page for non-authenticated users" do
user = create(:user)
visit root_path
expect( page ).to have_content 'LOG IN' # On sign-in page
fill_in 'Email', with: user.email
fill_in "Password", with: user.password
click_button 'Sign in'
expect( current_path ).to eq user_path(user)
end
end
describe 'registration' do
it "allows new users to register" do
visit root_path
click_link 'Sign up'
fill_in 'Email', with: 'myfake@email.com'
fill_in 'Password', with: 'password'
fill_in 'Password confirmation', with: 'password' …
Run Code Online (Sandbox Code Playgroud) 我已经将Rails应用程序推送到Heroku并继续遇到以下问题:
我将更改保存到我的主css.scss文件(在资产/样式表中)或资产/图像中的图像,推送到git,将其推送到heroku,然后重新加载页面,只是发现这些资产没有已装满了.
这也是本地服务器上的一个小问题,但输入:
rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
并重新加载本地服务器通常工作,而做
heroku run rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
然后重新推动什么也没做.我已经四处寻找信息并且没有找到任何特别有帮助的东西.
值得注意的是,在我的config/application.rb中(其中一些是钓鱼的结果):
# Enable the asset pipeline
config.assets.enabled = true
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
Run Code Online (Sandbox Code Playgroud)
在config/environments/production.rb中:
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts …
Run Code Online (Sandbox Code Playgroud) 我用Rails环顾了Stack Overflow和Agile Development,但找不到能满足我所需要的所有部分的东西.
我刚刚在rails中生成了一个Cow模型.显然,Rails使用过时的复数牛("kine"),因此当我创建该模型时,它构建了一个Kine迁移:
class CreateKine < ActiveRecord::Migration
def change
create_table :kine do |t|
t.string :name
t.string :farm
t.string :breed
t.timestamps
end
end
end
Run Code Online (Sandbox Code Playgroud)
我知道我可以进入模型的.rb文件和set_table_name回牛,但我担心相关的控制器.如果我创建一个Cows控制器,它会不同步?
我怎样才能得到牛/奶牛的一切?谢谢.这是我的第一个应用程序之一,我已经因管理控制器模型关联而感到困惑,因此这个变形问题无济于事.
migration controller ruby-on-rails inflection ruby-on-rails-3
我正在用 Storybook 构建一个 Angular 应用程序。我希望我的故事具有可控制的旋钮,但其中一些组件需要ng-content
.
我无法让这两者协同工作,因为根据我的发现,使用 Storybook 将内容传递到组件中涉及template
在故事上设置 a 。不幸的是,模板似乎基本上覆盖了 Storybook 的旋钮传递道具。
这是示例:
button.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ui-button',
templateUrl: './button.component.html',
styleUrls: ['./button.component.scss']
})
export class ButtonComponent implements OnInit {
types: String[] = [];
constructor() {}
ngOnInit(): void {}
typeClasses(): String[] {
return this.types.map(t => `button--${t}`);
}
}
Run Code Online (Sandbox Code Playgroud)
按钮.component.html
<a class="button" [ngClass]="typeClasses()">
<ng-content></ng-content>
</a>
Run Code Online (Sandbox Code Playgroud)
button.component.stories.ts
import { text, array } from '@storybook/addon-knobs';
import { ButtonComponent } from './button.component';
export …
Run Code Online (Sandbox Code Playgroud) 我希望将文本垂直和水平居中放在页面变宽时生长的图像上.
我最初将图像设置为固定高度div的背景,在这种情况下,它相对容易居中,但由于背景图像不是结构,我无法将高度设置为自动函数宽度,当我选择更具响应性的设计时,我不得不抛弃这个选项.
所以我现在有一个包含两个元素的div,即img和overlay文本.图像宽度设置为其容器宽度的100%,高度也相应变化.因此,我不能将叠加文本设置为postion :absolute和top:80px或者其他东西,因为距离顶部的距离必须变化.甚至做顶部:25%或其他任何不起作用,因为a)如果页面宽度缩小以挤压文本,或者如果只有更多文本,则当有更多/更少的行时,垂直居中将被抛弃,并且b )百分比是任意的 - 它不是50或者其他东西,因为当我希望叠加的中心在那里时,这会使文本的顶部覆盖50%的图像.
除了其他方面,我看过这个帖子,它肯定很接近 - 但在两个解决方案中,图像高度无法调整大小,而在前者中,JS在页面加载时加载,但随后会冻结,以便如果我改变页面宽度/高度,事情就会变得糟糕.理想情况下,这个解决方案不会因为这个原因而涉及JS(即使它重新加载每个调整大小,感觉不理想),但如果这是唯一的解决方案,我会接受它.
另外,为了增加细节/乐趣,我在图像上设置了最大高度,因为即使在电影院显示器上,我也不希望它超过大约300px的高度.
当前尝试的基本小提琴,以及下面相同的代码.有任何想法吗?谢谢!
HTML
<div class='quotation_div'>
<img src='http://www.mountainprofessor.com/images/mount-ranier-mount-features-2.jpg'>
<div class='overlay'>
<p>Any reasonable amount of text should be able to go here. I want it to be able to center vertically even if it takes up 2 or 3 lines.</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.quotation_div {
position: relative;
display: table;
}
img {
width: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个基于 MUI 并使用 Storybook 和 TypeScript 构建的 React 组件库。因为 Storybook(使用 create-react-app)基于 Webpack,并且因为我的组件库包含无法使用以下命令编译的 SASS 文件tsc
,所以我使用 Webpack 来构建捆绑包。然后我将组件库导入到另一个 React 应用程序中,并使用它自己的 React 版本。
为了测试这一点,我构建了一个普通的 TypeScript create-react-app 演示应用程序,并从我托管的 Github 存储库上的特定分支导入我的库。当我尝试包含库中的组件时,TS 类型正确显示,但应用程序抛出这些错误之一,指出在底层 MUI 库中使用了挂钩。在我看来,这极有可能是 React 版本竞争问题,而不是钩子问题,因为 A) MUI 可以工作,B) 组件可以在 Storybook 中工作。
\n这是我的组件库的基本结构。
\n我将与构建无关的应用程序依赖项(React、MUI、MUI 依赖项)放入 中peerDependencies
,这样它们就不会重复。
package.json
{\n "name": "my-component-library",\n "version": "0.1.0",\n "private": true,\n "license": "MIT",\n "main": "dist/index.js",\n "types": "dist/types/index.d.ts",\n "dependencies": {\n "react-scripts": "5.0.0",\n "web-vitals": "^1.0.1"\n },\n "scripts": {\n "build": "webpack"\n // …
Run Code Online (Sandbox Code Playgroud) heroku ×2
angular ×1
angularjs ×1
capybara ×1
circleci ×1
codeship ×1
coffeescript ×1
controller ×1
crashlytics ×1
css ×1
css3 ×1
github ×1
html ×1
html5 ×1
inflection ×1
ios ×1
javascript ×1
lodash ×1
material-ui ×1
migration ×1
npm ×1
permissions ×1
postgresql ×1
react-native ×1
reactjs ×1
rspec ×1
selenium ×1
ssh ×1
ssh-keys ×1
storybook ×1
terminal ×1
typescript ×1
webpack ×1
xcode ×1