我注意到Google Chrome的用户代理样式表中有些奇怪.i这些选择器(之后type="")的意思/做法是什么?
input[type="radio" i],
input[type="checkbox" i] {
background-color: initial;
margin: 3px 0.5ex;
padding: initial;
border: initial;
}
Run Code Online (Sandbox Code Playgroud) 我想创建一个具有干净主目录的用户,但是在使用用户模块时,我默认获得 files .bashrc,.bash_logout并且.profile(这些是 中的默认值/etc/skel/)
没有它们我如何创建用户?
剧本的相关部分:
- name: Create user
become: true
user:
name: johndoe
state: present
shell: /bin/bash
system: no
createhome: yes
home: /data/johndoe
Run Code Online (Sandbox Code Playgroud) 为什么这样做:
$.ajax(
{
url: "/some/url.php",
data: { s:"stuff" },
success: function(result)
{
// Result being <button id="clickme">Click me!</button>
$("#container").html(result);
// Event trigger *in* AJAX
$("#clickme").on("click", function()
{
alert("Hai");
});
}
});
Run Code Online (Sandbox Code Playgroud)
而这不是:
$.ajax(
{
url: "/some/url.php",
data: { s:"stuff" },
success: function(result)
{
// Result being <button id="clickme">Click me!</button>
$("#container").html(result);
}
});
// Event trigger outside AJAX, for better overview, like event grouping,
// shorter AJAX functions, etc
$("#clickme").on("click", function()
{
alert("Hai");
});
Run Code Online (Sandbox Code Playgroud)
使用jQuery v1.7.2
SystemJS可以指定从导入的文件中呈现的内容类型:
System.import('my/file.css!')System.import('some/image.png!image')System.import('some/data.json!').then(function(json){})System.import('some/text.txt!text').then(function(text) {})(来源)
使用SystemJS,从附加类型的文件导入,会在Webstorm中出错.
所以当我这样做时:
import template from './404.template.html!text';
Run Code Online (Sandbox Code Playgroud)
意思是我需要纯文本的html文件,Webstorm显示错误说:
无法解析文件'404.template.html!text'
在我的所有项目文件结构树中显示红色下划线.
我怎样才能得到Webstorm只能解决部分之前的!?
我想让我的代码保持干燥并创建 3 个(或更多或更少)具有相同结构的按钮。因此,我创建了一个要循环的对象列表,并将数据放入对象内,以便在 AppButton 中的多个位置使用。
我可能觉得有点太Pythonic了,因为那是我的主要语言,而且我最近才开始使用Kotlin。我通常用Python做的事情:
app_buttons = [
dict(
text="....",
icon="....",
uri_string="....",
),
...
]
Run Code Online (Sandbox Code Playgroud)
我在 Kotlin 中尝试过类似的方法mapOf:
val appButtons = arrayOf(
mapOf(
"title" to getString(R.string.app_btn_example1),
"icon" to R.drawable.ic_some_icon_1_64,
"uriString" to "myapp://example1",
),
...
)
Run Code Online (Sandbox Code Playgroud)
然后循环它们并从地图中获取:
for (entry in appButtons) {
buttons.add(
AppButton(
entry.get("text"),
entry.get("icon"),
) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(entry.get("uriString"))).apply {
val name = getString(R.string.saved_account_key)
putExtra(name, sharedPref.getString(name, null))
}
startActivity(intent)
}
)
}
Run Code Online (Sandbox Code Playgroud)
但后来我明白了Type mismatch. Required String. Found {Comparable & java.io.Serializable}?。我不知道该把什么类型放在哪里......
好的不同的方法,使用setOf …