是否有一种在RequireJS模块中传递服务器数据的首选方法?我们当前的实现类似于以下代码片段; 使用'page'对象来保存任何服务器/动态数据并将其传递给主引导程序.(我们现在不想使用ajax来填充任何依赖项)
从服务器页面:
<script data-main="scripts/main" src="scripts/require-jquery.js"></script>
<script type="text/javascript">
define("page", function () {
return { guid: "<%=Guid.NewGuid() %>" };
});
</script>
Run Code Online (Sandbox Code Playgroud)
main.js
require(["jquery", "jquery.alpha", "page"], function ($, alpha, page) {
alpha.initialize(page);
});
Run Code Online (Sandbox Code Playgroud)
jquery.apha.js
define(["jquery", "page"], function ($, page) {
return {
initialize: function () {
console.log(page.guid);
//logs guid as expected
}
}
});
Run Code Online (Sandbox Code Playgroud) 使用git-filter-repo是否可以将 N 个存储库组合成一个单一存储库,重写提交,以便提交交织在一起,或者按日期“压缩”?目前,我仅使用 2 个存储库对此进行测试,每个存储库都有自己的子目录。操作后,每个存储库的提交都位于彼此的“顶部”,而不是交织在一起。我真正想要的是能够通过创作数据拥有完全线性的历史记录,而无需添加合并提交。
rm -rf ___x
mkdir ___x
cd ___x
echo "creating the monorepo"
git init
touch "README.md"
git add .
git commit -am "Hello World!"
declare -A data
data=(
["foo"]="https://github.com/bcanzanella/foo.git"
["bar"]="https://github.com/bcanzanella/bar.git"
)
for d in "${!data[@]}";
do {
REPO_NAME=$d
REPO_REMOTE=${data[$d]}
# since we can use a foo/bar as the repo identifier, replace the / with a -
REPO_DIR_TMP="$(mktemp -d -t "${REPO_NAME/\//-}.XXXX")"
echo "REPO REMOTE: $REPO_REMOTE"
echo "REPO NAME: $REPO_NAME"
echo "REPO TMP DIR: $REPO_DIR_TMP"
echo …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用此端点使用 GitLab api 在文件的特定行上创建关于合并请求的讨论说明:https : //docs.gitlab.com/ee/api/discussions.html#create-new-合并请求线程
部分有效载荷要求 line_code
| 属性 | 类型 | 必需的 | 描述 |
|---|---|---|---|
| 位置[line_range][开始][line_code] | 细绳 | 是的 | 起始行的行代码 |
当我发出 POST 时,我收到以下回复:
"message": "400 (Bad request) \"Note {:line_code=>[\"can't be blank\", \"must be a valid line code\"], :position=>[\"is incomplete\"]}\" not given"
Run Code Online (Sandbox Code Playgroud)
这是什么line_code?它是某种计算值吗?这里的文档相当模糊。
当我为 merge_request 上的所有当前注释发出 GET 时,我可以看到一些注释有这个line_code(见下文)。我试图弄清楚如何为新笔记创造价值。
{
"id": 89,
"type": "DiffNote",
"body": "4",
"attachment": null,
"author": {
"id": 6,
"name": "brian c",
"username": "bc",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/f590a9cf57136732dd0cb5z9b1563390?s=80&d=identicon",
"web_url": "http://gitlab.mycompany.us/thisIsMe"
},
"created_at": "2021-01-11T21:46:23.861Z",
"updated_at": "2021-01-11T21:46:23.861Z",
"system": false,
"noteable_id": …Run Code Online (Sandbox Code Playgroud) 假设我有一个名为 acme/widget 的工作区和存储库,并且我有一个名为 brianc/widget 的分支。使用 BitBucket api,如何创建从我的存储库到上游的拉取请求?
在文档中似乎没有办法进行这种跨存储库拉取请求创建,因为这似乎branch是唯一允许的变量。有任何想法吗?
有没有办法,无论是内置的还是通过第三方扩展,在文本编辑器中禁用三次单击以选择整行?要么是我的鼠标太敏感,要么是我无意中这样做,但通常情况下,单击一个词,然后复制/粘贴它会导致粘贴整行——这不是我的本意,而且很烦人。理想情况下,它可以被禁用(也就是任何点击超过 1 次只是选择光标所在的单词)
在我正在开发的 Visual Studio 扩展中,我提供了一个自定义工具窗口。
我试图找出用户是否将工具窗口停靠在一侧(左侧/右侧/顶部/底部)或者它是否是浮动的。有没有办法计算我的工具窗口的当前位置,并且在用户完成移动它后是否有事件要知道?
一些背景:我正在为 Visual Studio 开发 CodeStream 扩展。有一个功能,当用户选择代码时,我们会在 CodeStream 工具窗口(它实际上是一个 web 视图)中显示三个圆形按钮以提供一些操作。当 CodeStream 面板停靠在右侧时,3 个按钮位于面板左侧,这是正确的。
但是,如果用户将 CodeStream 面板移动到屏幕左侧或其他地方,我希望能够知道这一点,以便我可以指导我们的 webview 将 3 个按钮移动到屏幕右侧。我在下面提供了两个屏幕截图。
我们还有一个 VSCode 扩展,我在那里实现了类似的逻辑。
c# visual-studio visual-studio-extensions visual-studio-2019
我最近在尝试发布 Visual Studio 2019 扩展时开始收到此错误。据我所知,清单文件没有损坏 [此文件已上传多年],但使用 VsixPublisher.exe 以及当我手动尝试将 VSIX 上传到 MSFT 市场时均失败。内部名称('codestream-vs')上有一个架构警告,但我们已经有这种情况很多年了。这是错误:
VSSDK: error VsixPub0029 : An error occurred while communicating with the marketplace: UploadFile: The package contains an invalid VSIX manifest file. This VSIX does not apply to any product installed on this machine. The problem could be that the VSIX manifest's format is not recognized, or that the manifest has been corrupted.
https://github.com/TeamCodeStream/codestream/blob/master/vs/publishManifest.json https://github.com/TeamCodeStream/codestream/blob/master/vs/src/CodeStream.VisualStudio/source.extension.vsixmanifest
在下面的代码示例中,Debug.Assert将失败.
如果从IBreaker注册中删除了AsImplementedInterfaces()扩展,则foo.Bar将不为null.为什么会这样?
using System;
using System.Diagnostics;
using System.Reflection;
using Autofac;
namespace AutoFacTest
{
class Program
{
static void Main(string[] args)
{
var builder = new ContainerBuilder();
var thisAssembly = Assembly.GetExecutingAssembly();
builder.RegisterAssemblyTypes(typeof(IFoo<>).Assembly, thisAssembly).AsClosedTypesOf(typeof(IFoo<>))
.AsImplementedInterfaces().PropertiesAutowired().InstancePerDependency();
builder.RegisterAssemblyTypes(typeof(IBar<>).Assembly, thisAssembly)
.AsClosedTypesOf(typeof(IBar<>)).AsImplementedInterfaces().InstancePerDependency();
builder.RegisterAssemblyTypes(typeof(IBreaker).Assembly, thisAssembly).InstancePerDependency()
.AsImplementedInterfaces(); //<------ will work if this is removed
var container = builder.Build();
var foo = container.Resolve<IFoo<int>>();
Debug.Assert(foo.Bar!=null);
Console.ReadLine();
}
}
public interface IBreaker {}
public class BreakerImpl<T> : IBreaker {}
public class BarImpl : IBar<int>{}
public class FooImpl : IFoo<int>
{
public …Run Code Online (Sandbox Code Playgroud) 是否可以以某种方式注册组件,以便可以根据构造函数参数解析它们?
public interface IRepository<T>{}
public interface IMyRepo {}
public class MyRepo : IRepository<TEntity>, IMyRepo
{
public MyRepo(IDbConnection connection){}
public MyRepo(){}
}
// lots of other repositories...
public class Global
{
public void BuildDIContainer()
{
var builder = new ContainerBuilder();
var assembly = Assembly.GetExecutingAssembly();
//any class that implements IRepository<T> is instance per request
builder.RegisterAssemblyTypes(typeof (IRepository<>).Assembly, assembly)
.AsClosedTypesOf(typeof (IRepository<>))
.AsImplementedInterfaces().InstancePerHttpRequest();
//any class that implements IRepository<T> with IDbConnection as ctor parameter is instance per dependency
builder.RegisterAssemblyTypes(typeof(IRepository<>).Assembly, assembly)
.UsingConstructor(typeof(IDbConnection)) // <-- ??
.AsClosedTypesOf(typeof(IRepository<>))
.AsImplementedInterfaces().InstancePerDependency(); …Run Code Online (Sandbox Code Playgroud) c# ×3
autofac ×2
.net ×1
bash ×1
bitbucket ×1
fork ×1
git ×1
github ×1
gitlab ×1
gitlab-api ×1
javascript ×1
jquery ×1
pull-request ×1
requirejs ×1