我有一个Dockerfile,有这样的语法 COPY ["Gemfile", "Gemfile.lock", "Procfile", ".env", "/huginn/"]
我RUN /bin/bash -l -c "ls -a"用来检查文件应对状态,我发现.env文件不要复制到图像.
我将.env文件名更改为test.env并使用COPY ["Gemfile", "Gemfile.lock", "Procfile", "test.env", "/huginn/"],然后它工作,test.env被复制到图像.
谁知道为什么?任何解决方案都可以让COPYdocker 支持.env文件名?
我已经有很多两个值数组,例如下面的例子
ary = [[1, 2], [2, 3], [1, 3], [4, 5], [5, 6], [4, 7], [7, 8], [4, 8]]
Run Code Online (Sandbox Code Playgroud)
我想将它们分组
[1, 2, 3], [4, 5], [5, 6], [4, 7, 8]
Run Code Online (Sandbox Code Playgroud)
因为意思是1和2有关系,2和3有关系,1和3有关系,所以1,2,3都有关系
我怎么能通过ruby lib或任何算法来做到这一点?
我有一个由 material-ui 构建的选择,所有功能都很好,但我想将选择列表的顶行与输入块的底行对齐,我该怎么做?
我的代码:
const styles = theme => ({
formControl: {
margin: theme.spacing.unit
}
});
<FormControl className={classes.formControl} fullWidth={true}>
<InputLabel htmlFor="deviceSource-native-select">Device source</InputLabel>
<Select
native={true}
onChange={this.onDeviceSourceChange}
inputProps={{
id: 'deviceSource-native-select',
name: 'deviceSource'
}}
>
<option value={'Ten'}>Ten</option>
<option value={'Twenty'}>Twenty</option>
<option value={'Thirty'}>Thirty</option>
</Select>
</FormControl>
Run Code Online (Sandbox Code Playgroud)
我有两种方法:
def ios_ids
@ios_ids ||= Array(GcmToken.find_by(users_id: "#{@event.user_id}", os_type: 'ios', alive: true).try(:reg_id))
end
def android_ids
@android_ids ||= Array(GcmToken.find_by(users_id: "#{@event.user_id}", os_type: 'android', alive: true).try(:reg_id))
end
Run Code Online (Sandbox Code Playgroud)
我想把它们折射成下面的东西
%w(android ios).each do |os_type|
define_method(:"#{os_type}_ids") { "@#{os_type}_ids" ||= Array(GcmToken.find_by(users_id: "#{@event.user_id}", os_type: os_type, alive: true).try(:reg_id))}
end
Run Code Online (Sandbox Code Playgroud)
但它不起作用
有人有任何答案或更好的解决方案?
我在下面有一个代码,正如你在第一次看到console.log类的原型时那样,它返回空,但是这个类中的new对象实际上可以响应那些方法,然后我在原型中添加函数并带来新对象成功,怎么解释呢?
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
get area() {
return this.calcArea()
}
calcArea() {
return this.height * this.width;
}
}
console.log(Polygon.prototype)
polygon = new Polygon(222,122)
console.log(polygon.area)
console.log(polygon.calcArea())
Polygon.prototype.test = function(){ return "test"}
console.log(Polygon.prototype)
console.log(polygon.test())
Run Code Online (Sandbox Code Playgroud)
Polygon {}
27084
27084
Polygon { test: [Function] }
test
Run Code Online (Sandbox Code Playgroud) ruby ×2
algorithm ×1
arrays ×1
css ×1
docker ×1
dockerfile ×1
ecmascript-6 ×1
grouping ×1
javascript ×1
linux ×1
material-ui ×1
reactjs ×1
ubuntu ×1