我总是在计算日期函数时遇到问题
var d = new Date(),
month = d.getMonth(),
mondays = [];
d.setDate(1);
// Get the first Monday in the month
while (d.getDay() !== 1) {
d.setDate(d.getDate() + 1);
}
// Get all the other Mondays in the month
while (d.getMonth() === month) {
var pushDate = new Date(d.getTime());
mondays.push(pushDate.getDate() + '-' + (pushDate.getMonth()+1) + '-' + pushDate.getFullYear());
d.setDate(d.getDate() + 7);
}
Run Code Online (Sandbox Code Playgroud)
我正在使用此函数获取当月的所有星期一。
如何修改此代码以获得一年中所有剩余的星期一?
我能够从谷歌分析API运行de“hello”应用程序:
function getFirstProfileId($analytics) {
// Get the user's first view (profile) ID.
// Get the list of accounts for the authorized user.
$accounts = $analytics->management_accounts->listManagementAccounts();
if (count($accounts->getItems()) > 0) {
$items = $accounts->getItems();
$firstAccountId = $items[0]->getId();
// Get the list of properties for the authorized user.
$properties = $analytics->management_webproperties
->listManagementWebproperties($firstAccountId);
if (count($properties->getItems()) > 0) {
$items = $properties->getItems();
$firstPropertyId = $items[0]->getId();
// Get the list of views (profiles) for the authorized user.
$profiles = $analytics->management_profiles->listManagementProfiles($firstAccountId, $firstPropertyId);
if (count($profiles->getItems()) > 0) …Run Code Online (Sandbox Code Playgroud) 我有一个使用cordova 构建的Android/IOS 应用程序。
由于我现在正在使用 ssl 运行服务器,因此无法使用 inappBrowser 打开来自 google 的请求。所以我必须使用本机登录和这个插件。(这是我找到的最可靠的)
在阅读了许多帖子(this,this和..)之后,我相信问题出在我(试图)生成我的密钥文件的方式中
keytool -exportcert -keystore ~/.android/debug.keystore -list -v -alias myAppName
Run Code Online (Sandbox Code Playgroud)
(密码为空)它提示
error de herramienta de claves: java.lang.Exception: El alias <myAppName> no existe (doesn't exist)
java.lang.Exception: El alias <myAppName> no existe
at sun.security.tools.keytool.Main.doPrintEntry(Main.java:1738)
at sun.security.tools.keytool.Main.doCommands(Main.java:1064)
at sun.security.tools.keytool.Main.run(Main.java:343)
at sun.security.tools.keytool.Main.main(Main.java:336)
Run Code Online (Sandbox Code Playgroud)
这是否意味着它不起作用?
关于错误:
window.plugins.googleplus.login(
{
'scopes': 'profile email',
'webClientId': 'xxxxxxxxx.apps.googleusercontent.com',
'offline': true,
},
function (obj) {
alert(JSON.stringify(obj)); /
},
function (msg) {
alert('error: ' + msg); …Run Code Online (Sandbox Code Playgroud) 对于单个文件,我使用以下 ImageMagick 命令(如 google建议):
对于 png
convert file.png -sampling-factor 4:2:0 -strip -quality 85 -interlace PNG -colorspace sRGB file.png
Run Code Online (Sandbox Code Playgroud)
为jpg
convert file.jpg -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB file.jpg
Run Code Online (Sandbox Code Playgroud)
但我需要对子文件夹中的所有 .jpg 做同样的事情
我试过这个:
find ./*.jpg | xargs convert $ -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB $
Run Code Online (Sandbox Code Playgroud)
以及所有压缩但以第一个名称命名并添加索引的图像,例如:
/img/first-one-0.jpg
/img/first-one-1.jpg
/img/first-one-2.jpg
/img/first-one-3.jpg
...
Run Code Online (Sandbox Code Playgroud)
我怎么能批量覆盖原件?即使我们有多个子目录:
/img/dir-1/one.jpg
...
/img/dir-2/foo.jpg
Run Code Online (Sandbox Code Playgroud) 我有一个奇怪的问题。我认为$refs可以从mounted()生命周期中获得
但如果我尝试log直接它是我得到未定义的对象:
mounted() {
// logs undefined
console.log(
this.$refs.tabsMenu
)
}
Run Code Online (Sandbox Code Playgroud)
等待 1ms 后它就被定义了,我可以得到对象
mounted() {
setTimeout(() => {
// logs the object
console.log(
this.$refs.tabsMenu
)
}, 1) // <-- just 1ms!
}
Run Code Online (Sandbox Code Playgroud)
对此有什么想法吗?
我的(简化的)模板如下所示
<template>
<div>
<baseContainer>
<ul ref="tabsMenu" id="tabs-menu" class="flex-inline flex w-full">
<li>Home</li>
<!-- many more items -->
<li>Contact</li>
</ul>
</baseContainer>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我可以假设我不能申请.css()body 标签吗?
因为如果我这样做$("#div")......它有效吗?
我这样加载:
$('.selector').each(function(){
$(this).qtip({
content: { url: '/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'<center><img src="/images/loader.gif" alt="loading..." /></center>' },
show: { delay: 700, solo: true,effect: { length: 500 }},
hide: { fixed: true, delay: 200 },
position: {
corner: {
target: 'topRight',
tooltip: 'left'
}
},
show: {
// Show it on click
solo: true // And hide all other tooltips
},
style: {
name: 'light',
width: 730,border: {
width: 4,
radius: 3,
color: '#5588CC'
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
这看起来好像是有效果的因果关系.但qtip.php它没有延迟,这是我真正想要的(减少不必要的请求)
那么,我可以在加载qtip.php之前延迟300ms吗?
非常感谢
让我说我正在制作一个节日网站,如果你今天进入你会看到2010年版本,因为2011年版本没有完成,
我想让我的用户知道他们正在查看旧网站,他们将被重定向到Facebook页面(直到新网站完成),
使用此代码,我将重定向到我们的Facebook页面
<SCRIPT LANGUAGE='JavaScript'>
window.alert('This is the old edition of our webiste. The new one will be avaliable soon. You would be redirected')
window.location.href='http://facebook.com/ourfacebookpage';
</SCRIPT>
Run Code Online (Sandbox Code Playgroud)
但我怎么能让用户留下来?(例如,取消/留在这里按钮)所以用户可以看到旧网站(但他知道这是旧网站)
非常感谢任何想法!
$('#container img')
.clone()
.appendTo('#container')
.css({'position' : 'absolute','z-index':9999,marginLeft:-100})
.animate({opacity: 0.1, left: 200,top:200,height:420}, 1000, function() {
$(this).remove();
actualizar(iGal);
});
Run Code Online (Sandbox Code Playgroud)
Basicalli我想把它移动200px到左边,200到底部,但是它会被移动到页面cordenade 200px左边和200px底部,
.css({'position','relative'});
Run Code Online (Sandbox Code Playgroud)
相反,但是这个位置没有被瞄准,
我错过了什么?我必须用胶印做吗?
我昨天提出这个问题:背景重复在精灵图像中平铺bgImage?
因此,长期不可能重复精灵图像内部的背景,
创建精灵时最好的*策略是什么?
我的意思是,选择:
*)当我说最好的意思是最可访问/可用/性能
javascript ×5
jquery ×3
css ×2
image ×2
abort ×1
absolute ×1
alert ×1
api ×1
bulk ×1
cordova ×1
css-sprites ×1
date ×1
delay ×1
google-api ×1
imagemagick ×1
lifecycle ×1
linux ×1
macos ×1
optimization ×1
php ×1
qtip ×1
settimeout ×1
vue.js ×1