嗨我使用uberspace并在那里安装鬼.Ghost使用npm.
如果我尝试:
npm install -g bower
Run Code Online (Sandbox Code Playgroud)
它不会安装它并抛出许多有意义的错误消息,因为服务器在许多用户之间共享.sudo npm install -g bower告诉我它不知道凉亭
如果我在本地安装它
npm install bower
Run Code Online (Sandbox Code Playgroud)
它将它安装到../node_modules.但是使用例如
bower install angular-mailchimp
Run Code Online (Sandbox Code Playgroud)
抛出错误:-bash:bower:command not found
我如何让它运行?
我有一个带有重播主题的服务。
export class UserService {
public userChanged: ReplaySubject<User> = new ReplaySubject<User>();
...
public getUser(userId?): void {
...
this.http.get(url, httpOptions).pipe(
catchError(this.handleError('getUser', null, 'Couldn\'t get user', options))
).subscribe( (user: User) => {
this.userChanged.next(user);
});
}
Run Code Online (Sandbox Code Playgroud)
我的组件订阅了userChanged.
this.userService.userChanged.subscribe((user) => {
this.user = user;
});
Run Code Online (Sandbox Code Playgroud)
现在,我想UserService在组件测试中模拟我的:
1 个选项在 Angular 中测试 Observables )
import { of } from 'rxjs';
...
const userServiceSpy = jasmine.createSpyObj('UserService', {'userChanged': of({_id: '1'}) });
Run Code Online (Sandbox Code Playgroud)
或 2 个选项)
const userServiceSpy = jasmine.createSpyObj('UserService', {'userChanged': () => of({_id: '1'}) …Run Code Online (Sandbox Code Playgroud) 我对身份验证过程的理解。主机创建一个secret和一个public api key。客户端借助密钥对有效负载进行加密,这就是签名。然后将其公钥,有效负载,签名发送给主机。
主机检查是否允许公钥进行操作,并根据客户端的公钥获取机密。在秘密的帮助下,主机解密签名并将其与有效负载进行比较。
update和Node Docs到底做了什么digest authenticate: (self)->
payload = 'AUTH' + moment()
signature = crypto.createHmac('sha384', WEBSOCKET_SECRET)
.update(payload)
.digest('hex')
data = {
event: 'auth',
apiKey: WEBSOCKET_KEY,
authSig: signature,
authPayload: payload
}
self.send self, data
Run Code Online (Sandbox Code Playgroud)
hmac = crypto.createHmac('sha384', WEBSOCKET_SECRET)
hmac.on 'readable', () ->
data = hmac.read()
if (data)
console.log data, data.toString('utf-8')
# hmac.write(authPayload)
hmac.write(signature)
hmac.end()
Run Code Online (Sandbox Code Playgroud)
authenticate: (authPublicKey, authSignature, authPayload)->
signature = crypto.createHmac('sha384', WEBSOCKET_SECRET)
.update(authPayload) …Run Code Online (Sandbox Code Playgroud) 您好我如何组合我的document.querySelectorAll如果我有这样的情况:
<div>
<p class="flower">Flower 1</p>
<p class="bee">Bee 1</p>
<p class="tree"></p>
</div>
<div>
<p class="flower">Flower 2</p>
<p class="dude"></p>
<p class="snow-leopard"></p>
</div>
<div>
<p class="flower">Flower 3</p>
<p class="tree"></p>
<p class="mountain"></p>
<p class="wizard"></p>
<p class="bee">Bee 3</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我一直想选花,如果有一只蜜蜂,我想将它附在花上,我不在乎其余的.花和蜜蜂在div中没有特定的顺序,有些情况下没有蜜蜂.还假设花和蜂有一个类,但结构的其余部分不像示例中那样干净.到目前为止,我唯一的解决方案是升级几个级别然后使用正则表达式.最后我想把它们都包含在一个json中:
[{flower: "yellow", bee:"bumblebee"},...]
Run Code Online (Sandbox Code Playgroud)
这种方法:
var flowers = document.querySelectorAll(flower);
var bees = document.querySelectorAll(bee);
Run Code Online (Sandbox Code Playgroud)
然后在两个阵列上进行迭代不起作用.
angular ×1
bower ×1
casperjs ×1
hmac ×1
javascript ×1
node.js ×1
npm ×1
uberspace ×1
unit-testing ×1