我有一个正常的repo,其中有一个工作树和一个.git文件夹在与工作树相同的目录中.
我正在尝试使用该命令从该位置外部运行git命令
git --git-dir=/path/to/repo/.git --work-tree=/path/to/repo pull /some/other/repo master
Run Code Online (Sandbox Code Playgroud)
但我一直在收到错误fatal: /usr/libexec/git-core/git-pull cannot be used without a working tree..
我究竟做错了什么?
在推送到git repo之后,我收到了这个错误:
[trusktr@starlancer bml]$ git push origin trusktr
Password:
Counting objects: 13, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 763 bytes, done.
Total 7 (delta 6), reused 0 (delta 0)
remote: fatal: bad object 0000000000000000000000000000000000000000
To ssh://trusktr@buzztard.git.sourceforge.net/gitroot/buzztard/bml
* [new branch] trusktr -> trusktr
Run Code Online (Sandbox Code Playgroud) 例如,双击某个单词会选择该单词,然后该单词的所有匹配也会突出显示.
我在主题中更改了哪些键来更改匹配单词的背景,前景和/或边框颜色?
通常,我运行tsc -p ./tsconfig.json哪种类型的检查文件./src夹中相对于tsconfig的所有文件。
但是如果我跑步tsc -p ./tsconfig.json src/specific-file.ts,它会抱怨
错误TS5042:选项“项目”不能与命令行上的源文件混合。
因此,如果我删除该选项并运行,tsc src/specific-file.ts它将检查文件,但它不使用tsconfig中的任何设置(因为我没有指定tsconfig文件?)。
如何tsc在单个文件上运行并使用tsconfig中的设置,否则它们将在整个项目中使用?
我的电子应用程序随机重定向到chrome-error://chromewebdata,我不知道为什么。控制台中没有错误等。
当 Electron 应用程序第一次启动时,窗口打开,它从我的应用程序重定向到该 URL,我看到一个空白的空白屏幕。不需要用户交互,它只是在应用程序启动时发生。
如果我打开 devtools,我可以看到window.location.href包含chrome-error://chromewebdata而不是http://localhost:9080(Electron 应用程序使用本地主机 URL 运行)。
我尝试删除本地 Electron/Chrome 数据文件夹~/Library/Application Support/my-app-name并重新开始,但没有成功。
Chrome(在 Electron 中?)可以决定重定向到的原因是什么chrome-error://chromewebdata?
我想拦截某些 HTTP 请求并用文件替换它们。所以我想我可以这样使用electron.protocol.interceptFileProtocol:
protocol.interceptFileProtocol('http', (request, callback) => {
// intercept only requests to "http://example.com"
if (request.url.startsWith("http://example.com")) {
callback("/path/to/file")
}
// otherwise, let the HTTP request behave like normal.
// But how?
})
Run Code Online (Sandbox Code Playgroud)
http除了http://example.com继续正常工作之外,我们如何允许其他请求?
我已经安装了three@^0.103.0,它有自己的类型定义。
在src/global.d.ts我的项目中我有:
import * as _THREE from 'three'
declare global {
const THREE: typeof _THREE
}
Run Code Online (Sandbox Code Playgroud)
然后在src/global.ts我有
import * as THREE from 'three'
(window as any).THREE = { ...THREE }
Run Code Online (Sandbox Code Playgroud)
然后在src/my-code.js我尝试使用THREE作为全局变量, fe
console.log(new THREE.Vector3(1,2,3)) // ERROR, 'THREE' refers to a UMD global, but the current file is a module. Consider adding an import instead.
Run Code Online (Sandbox Code Playgroud)
它告诉我'THREE' refers to a UMD global, but the current file is a module. Consider adding …
使用.load()(或任何jQuery ajax函数)从我的域上的任何位置请求数据都可以正常工作.
尝试访问其他域中的URL不起作用.你怎么做呢?另一个域也恰好是我的.
我读到了你可以用PHP做的一个技巧,并制作一个获取内容的代理,然后你在服务器上的那个php位置使用jQuery的ajax函数,但是你仍然在你自己的服务器上使用jQuery ajax这样就不算了.
有一个好的插件吗?
编辑:我发现了一个非常好的jQuery插件,允许您使用任何jQuery函数从其他页面请求内容,就像您在自己的域中的普通ajax请求一样.
帖子:http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
插件:https://github.com/jamespadolsey/jQuery-Plugins/tree/master/cross-domain-ajax/
例如,我有var menu_ready = false;.我有一个ajax函数,menu_ready当ajax完成时设置为true:
//set up event listener here
$(...).load(..., function() {
...
menu_ready = true;
}
Run Code Online (Sandbox Code Playgroud)
如何设置等待为menu_ready真的事件监听器?
我有一些如下代码,
const observer = new MutationObserver(records => {
for (const record of records) {
if (record.type !== 'attributes') continue
handleAttributeChange(
record.attributeName!,
record.oldValue,
record.target.attributes.getNamedItem(record.attributeName).value,
)
}
})
Run Code Online (Sandbox Code Playgroud)
其中handleAttributeChange参数是属性名称、旧值和新值。
但是,正如您所知,第三个参数传递给handleAttributeChange,
const observer = new MutationObserver(records => {
for (const record of records) {
if (record.type !== 'attributes') continue
handleAttributeChange(
record.attributeName!,
record.oldValue,
record.target.attributes.getNamedItem(record.attributeName).value,
)
}
})
Run Code Online (Sandbox Code Playgroud)
始终是最新的属性值,而不是我们正在迭代的特定突变记录的“新值”(即不是突变发生时观察到的“新值”)。
我们如何获得每个突变发生时观察到的“新值”?
javascript ×6
electron ×2
git ×2
jquery ×2
typescript ×2
ajax ×1
chromium ×1
cross-domain ×1
dom ×1
events ×1
git-commit ×1
git-pull ×1
git-push ×1
html ×1
sublimetext ×1
sublimetext2 ×1
three.js ×1
tsc ×1
tsconfig ×1