小编And*_*rew的帖子

如何将unix时间戳转换为日历日期moment.js

我有一个unix时间戳,我正在尝试将其转换为日历日期,如MM/DD/YYYY.到目前为止,我有这个:

$(document).ready(function() {
  var value = $("#unixtime").val(); //this retrieves the unix timestamp
  var dateString = moment(value).calendar(); 
  alert(dateString);
});
Run Code Online (Sandbox Code Playgroud)

当我尝试打印日历日期时,窗口显示"无效日期".谁能帮我吗?

javascript datetime momentjs

128
推荐指数
7
解决办法
19万
查看次数

echo语句php中的三元运算符

我正在尝试使用tenary运算符将if else块实现到echo语句中.如果在echo语句中阻塞,我已经跟着它了.但是我不知道我的错了:

echo "<td><input type='checkbox' name='money' id='money'".(($money == 'yes')?'"checked"':" "."value='yes' /></td>";
Run Code Online (Sandbox Code Playgroud)

php

13
推荐指数
1
解决办法
2万
查看次数

可以使用CSS中的百分比指定页面的某些部分吗?

所以,我一直在尝试在我的网站上创建一个水平滚动页面.我将整个滚动部分设置为400%,因为我有四页.但是,我想知道是否有可能(使用CSS,jQuery等)削减400%以便我可以使用0-100%作为第一页,100%-200%作为第二页等等?或者是否有另一种解决方法(我一直试图实现这一点,以实现跨浏览器/屏幕尺寸的兼容性).到目前为止,我只是设法使用硬像素,但有没有办法将其改为百分比?

HTML:

<div id="transition-slide-container">   
   <div id="transition-slide">
       <div id="inner-container>
        <div class="slide" id="home">
            <h1>home</h1>
        </div>
       </div>
        <div class="slide" id="portfolio">
          <div id="inner-container">
            <h1>portfolio</h1>
          </div>
        </div>
        <div class="slide" id="about">
           <div id="inner-container">
            <p>about</p>
           </div>
        </div>                  
        <div class="slide" id="contact">
           <div id="inner-container">
            <p>contact<p>
           </div>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

div#transition-slide-container {    
    background: #bee1ff;    
    padding-top: 128px;
    padding-bottom: 50px;
    height: 900px;
    min-width: 400%;    
    z-index: -1;
    float: left;
    position: relative;
}
div#transition-slide {
    white-space: nowrap;
}
.slide {
    display: inline-block;
    width: 1620px;
    margin: 0 auto; 
}
div#inner-container {
    width: 1024px;
    margin: …
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
1
解决办法
101
查看次数

CSS3径向渐变显示为线条

我一直在尝试创建一个径向背景,除了某些原因,我能得到的只是一条线.我不知道我做错了什么,有什么想法吗?

Jsfiddle:http://jsfiddle.net/3QSFj/1/

CSS:

background: -webkit-gradient(radial, circle, 0, circle, 70, color-stop(0%, #718aa7), color-stop(70%, #203044));
background: -webkit-radial-gradient(circle, #718aa7 0%, #203044 70%);
background: -moz-radial-gradient(circle, #718aa7 0%, #203044 70%);
background: -o-radial-gradient(circle, #718aa7 0%, #203044 70%);
background: radial-gradient(circle, #718aa7 0%, #203044 70%);
Run Code Online (Sandbox Code Playgroud)

css radial-gradients css3

5
推荐指数
1
解决办法
622
查看次数

使用 VSCode 调试 Docker 容器中的 Typescript 文件

我已经为此绞尽脑汁了几个小时,似乎无法在任何地方找到解决方案 -

\n\n

我在用 Typescript 编写的 Docker 容器中设置了一个简单的 Node API,我正在尝试使用 VSCode 附加到它进行调试。我能够连接到它(并且调试控制台显示它),但是一旦我尝试设置断点,我就会返回Breakpoints set but not yet bound

\n\n

这是我的 launch.json

\n\n
{\n  "version": "0.2.0",\n  "configurations": [\n    {\n      "name": "Attach to Docker",\n      "type": "node",\n      "request": "attach",\n      "port":9229,\n      "restart": true,\n      "sourceMaps": false,\n      "localRoot": "${workspaceRoot}",\n      "remoteRoot": "/api",\n      "protocol" : "inspector",\n      "trace": "verbose"\n    }\n  ]\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

带调试器的终端输出

\n\n
web_1       | Debugger listening on ws://0.0.0.0:9229/44aca479-580c-4ecb-a104-cf80f9041538                                              \xe2\x94\x82\nweb_1       | For help, see: https://nodejs.org/en/docs/inspector                                                                       \nweb_1       | Debugger attached.\n
Run Code Online (Sandbox Code Playgroud)\n\n

节点应用程序通过 启动node --inspect=0.0.0.0:9229。我尝试运行一些 Mocha 测试,但我之前设置的所有断点都被完全忽略了。谁能帮我看看吗?这是我当前的 …

mocha.js node.js typescript docker visual-studio-code

5
推荐指数
1
解决办法
1354
查看次数

如何打开基金会揭示模态javascript

我一直在尝试遵循Foundation文档,但我真的无法弄清楚如何使用jQuery打开模态窗口.这就是我所拥有的:

小提琴

HTML:

<a href="#" id="myModal" class="reveal-link">Name</a>

<div id="myModal" class="reveal-modal">
      <a class="close-reveal-modal">&#215;</a>
</div>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

$(document).ready(function(){
    $(document).foundation();
    $('a.reveal-link').trigger('click');
    $('a.close-reveal-modal').trigger('click');
 });
Run Code Online (Sandbox Code Playgroud)

谢谢,任何帮助将不胜感激!

jquery modal-dialog zurb-foundation

4
推荐指数
1
解决办法
2万
查看次数

div在位置后消失:相对

我正试图将图像放在容器内的右侧.但是,在我设置父容器后position: relative;,我的图像消失了.有任何想法吗?网站:http://andrewgu12.kodingen.com/.谢谢!

CSS:

.slide {
    padding-top: 138px;
    background-attachment: fixed;
    width: 100%;
    height: 100%;
    position: relative;
        box-shadow:inset 0px 10px 10px rgba(0,0,0,0.3); 
}
div#inner-container {
    text-align: left;
    width: 960px;
    margin: 0 auto;
    padding: 0;
    white-space: normal;
    position: relative;
}
div#name {
    right: 0;
    bottom: 200px;
    position: absolute;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="slide" id="home" data-slide="1" data-stellar-background-ratio="1">
        <div id="inner-container">
            <div id="name" clas="row">
                <img src="images/names.png">
            </div>                            
        </div>            
    </div>
Run Code Online (Sandbox Code Playgroud)

html css

3
推荐指数
1
解决办法
2万
查看次数

K&R C计算字符

我正在研究K&R的书,我正在编写如何从文本流中计算字符的代码示例.我复制了他们的代码并尝试运行它,但是当命令行提示你输入字符时,循环不会退出,因此永远不会打印出字符数.这里有错误,我没有抓到?

#include <stdio.h>

main() 
{
     long nc;
     nc = 0;
     while(getchar() != EOF) {
          ++nc;
     }
     printf("%1d\n", nc);
}
Run Code Online (Sandbox Code Playgroud)

c linux

3
推荐指数
1
解决办法
254
查看次数

Node Route.get()需要回调函数但得到一个[对象未定义]

我正在使用Passport创建Google OAuth2身份验证系统.我正在尝试用Coffeescript编写路径文件,除了某些原因我不断收到此错误:

D:\Programming\weebly-site\node_modules\express\lib\router\route.js:162
            throw new Error(msg);
                  ^
    Error: Route.get() requires callback functions but got a [object Undefined]
      at D:\Programming\weebly-site\node_modules\express\lib\router\route.js:162:15
      at Array.forEach (native)
      at Route.(anonymous function) [as get] (D:\Programming\weebly-site\node_module
    s\express\lib\router\route.js:158:15)
      at Function.proto.(anonymous function) [as get] (D:\Programming\weebly-site\no
    de_modules\express\lib\router\index.js:490:19)
      at Object.<anonymous> (D:\Programming\weebly-site\routes\admin.js:15:10)
      at Object.<anonymous> (D:\Programming\weebly-site\routes\admin.js:37:4)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Module.require (module.js:364:17)
      at require (module.js:380:17)
      at Object.<anonymous> (D:\Programming\weebly-site\app.js:16:19)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Module.require (module.js:364:17)
      at require …
Run Code Online (Sandbox Code Playgroud)

node.js coffeescript

3
推荐指数
1
解决办法
9498
查看次数

passport.js抛出未知的身份验证策略"Google"

我一直在关注这个指南,我不断收到错误"未知身份验证策略'google'".我不知道发生了什么,我已经尝试过搜索其他答案但收效甚微.任何帮助将不胜感激,谢谢!

错误:

Unknown authentication strategy "google"
Error: Unknown authentication strategy "google"
  at attempt (D:\Programming\weebly-site\node_modules\passport\lib\middleware\authenticate.js:166:37)
  at authenticate (D:\Programming\weebly-site\node_modules\passport\lib\middleware\authenticate.js:342:7)
  at Layer.handle [as handle_request] (D:\Programming\weebly-site\node_modules\express\lib\router\layer.js:76:5)
  at next (D:\Programming\weebly-site\node_modules\express\lib\router\route.js:100:13)
  at Route.dispatch (D:\Programming\weebly-site\node_modules\express\lib\router\route.js:81:3)
  at Layer.handle [as handle_request] (D:\Programming\weebly-site\node_modules\express\lib\router\layer.js:76:5)
  at D:\Programming\weebly-site\node_modules\express\lib\router\index.js:234:24
  at Function.proto.process_params (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:312:12)
  at D:\Programming\weebly-site\node_modules\express\lib\router\index.js:228:12
  at Function.match_layer (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:295:3)
  at next (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:189:10)
  at D:\Programming\weebly-site\node_modules\express\lib\router\index.js:191:16
  at Function.match_layer (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:295:3)
  at next (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:189:10)
  at D:\Programming\weebly-site\node_modules\express\lib\router\index.js:191:16
  at Function.match_layer (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:295:3)
  at next (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:189:10)
  at Function.proto.handle (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:165:3)
  at router (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:34:12)
  at Layer.handle [as handle_request] (D:\Programming\weebly-site\node_modules\express\lib\router\layer.js:76:5)
  at trim_prefix (D:\Programming\weebly-site\node_modules\express\lib\router\index.js:270:13)
  at D:\Programming\weebly-site\node_modules\express\lib\router\index.js:237:9 …
Run Code Online (Sandbox Code Playgroud)

javascript node.js google-oauth passport.js

3
推荐指数
1
解决办法
6911
查看次数