小编Fre*_*all的帖子

PureScript FFI到摩卡

我试图将mocha绑定写入PureScript,我完全不知所措 Control.Monad.Eff

describe(function(){
  //do stuff  
});
Run Code Online (Sandbox Code Playgroud)

描述是一个不带任何东西并返回IO,或Eff或其他东西的函数(副作用没有返回值).


到目前为止我的尝试

foreign import describe 
  "function describe(n){         \
  \ return function(){           \
  \   window.describe(n); \
  \ };                           \  
  \}" :: forall eff a. Eff eff a -> Eff eff

foreign import describe "describe" :: forall eff a. Eff eff a -> Eff eff
foreign import describe "describe" :: Eff -> Eff
foreign import describe "describe" :: forall eff a. (a -> Eff eff) -> Eff eff
Run Code Online (Sandbox Code Playgroud)

显然遗漏了一些东西.请帮忙.

ffi mocha.js purescript

12
推荐指数
1
解决办法
777
查看次数

设置jquery默认动画速度

我找不到任何文件.我只想设置jQuerys默认动画速度.像这样的东西:

 $.setDefaultAnimationSpeed = 5000; //does not work

 $('elem').fadeIn(); // takes 5 seconds
 $('elem').animate({
     foo : bar
 }); // also takes 5 seconds
Run Code Online (Sandbox Code Playgroud)

谢谢大家!

jquery

11
推荐指数
1
解决办法
3910
查看次数

全宽和高SVG

困境:制作一个完整的窗口svg图像,填充方面失真,不使用SVG标签.为什么没有svg标签?因为我打算在页面的生命周期中稍后交换SVG(如果不经常),我还没有找到一种简单的方法来做到这一点.

失败的尝试:

  <!-- for the record, my style are in a css file, 
       for example purposes they are style attrs-->

  <!-- Working in Webkit but not in firefox, in firefox blocks stretching 
       and places the svg in the middle of the tag-->
  <img src="my.svg" style="width:100%;height:100%;
       position:fixed;top:0;left:0;bottom:0;right:0;" />

  <!-- Both Webkit and Firefox block distortion, so the svg 
       appears centered in the div rather than conforming to the div-->
  <div style="width:100%;height:100%;position:fixed;top:0;
       left:0;bottom:0;right:0;background-size:cover;
       background-image:url(my.svg);" />
Run Code Online (Sandbox Code Playgroud)

我也试过了

 background-size:contain;
 background-size:cover;
 background-size:100% 100%;
 background-postion: center …
Run Code Online (Sandbox Code Playgroud)

css svg css3

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

coffeescript扩展类构造函数

 class RedGuy
       constructor : (@name) ->
           @nameElem = $ @name
           @nameElem.css color : red

 class WideRedGuy extends RedGuy
       constructor : ->
           @nameElem.css width : 900

 jeff = new WideRedGuy '#jeff'
Run Code Online (Sandbox Code Playgroud)

我想要#jeff既红又宽,但我总是得到this.name is undefined.如何扩展构造函数(追加?)以便我可以访问原始对象的属性?

oop coffeescript

11
推荐指数
1
解决办法
5523
查看次数

iPhone不会自动转向颠倒

我有

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
Run Code Online (Sandbox Code Playgroud)

在info.plist中并进行搜索并设置shouldAutorotateToInterfaceOrientation要返回的每个实例YES.但在iPhone上它表现得好像不支持颠倒.UpsideUp肖像作品,风景作品,上下颠倒显示风景.为什么?

iPad适用于所有方向.他们分享.xibs


UPDATE

我已经补充说了

- (BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;    
}
Run Code Online (Sandbox Code Playgroud)

在每一个现有的实例之后shouldAutorotateToInterfaceOrientation,仍然没有爱.

我的目标是iOS 4.3,但我的模拟器和物理设备运行iOS 6

iphone objective-c uiinterfaceorientation ios

11
推荐指数
1
解决办法
7016
查看次数

iPad JavaScript错误无用

我得到以下错误和iPad但不在桌面浏览器中:

JavaScript: Error
undefined
TypeError: 'undefined' is not a function
Run Code Online (Sandbox Code Playgroud)

这是一个更大的js应用程序,这个错误消息完全没有用.有什么方法可以得到错误的行号或更多信息吗?

更新:这只是时髦.

line : 0    
page : undefined
desc : TypeError: 'undefined' is not a function
chr  : undefined
Run Code Online (Sandbox Code Playgroud)

用户代理是否在FF和Safari中进行了欺骗.没错.

javascript jquery ios

10
推荐指数
1
解决办法
5168
查看次数

什么是haskell中的<|>?

我还在学习haskell并查看snap web框架.在他们的hello world例子中,有一个看起来很像的东西<|>

site :: Snap ()
site =
    ifTop (writeBS "hello world") <|>
    route [ ("foo", writeBS "bar")
          , ("echo/:echoparam", echoHandler)
          ] <|>
    dir "static" (serveDirectory ".")
Run Code Online (Sandbox Code Playgroud)

谷歌搜索这是惊人的挑战,快照文档只是<|>用作名词.它是什么,它做了什么?

haskell haskell-snap-framework

10
推荐指数
1
解决办法
309
查看次数

用于移除移动Web应用程序中的地址栏的跨平台方法

我正在开发一个移动网络应用程序,我正在尝试删除地址栏.它很容易,除非它<body>的自然高度不够高,不允许滚动.尝试我可能找不到可靠的iphone/android,跨设备方法确保<body>足够高以允许地址栏消失.我见过的许多方法都依赖于screen.height它使得页面比它需要的更加严格.它应该非常高,足以让地址栏消失,不会更高!

有没有人有一个完美处理这个的脚本?我需要确定页面的高度减去iphone和android的地址栏.

我试过了:

screen.height //too tall
window.innerHeight //too short
document.documentElement.clientHeight //too short
document.body.clientHeight //almost but too short
Run Code Online (Sandbox Code Playgroud)

允许JQUERY.

javascript jquery android web-applications mobile-safari

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

在iPad上设置日期输入的值

WEB APP不是原生的,没有Objective-C

这很简单,很疼.

  <input type="date" />
Run Code Online (Sandbox Code Playgroud)

完成使用iPad本机日期选择器.然后用jQuery设置初始值

  $('input[type="date"]').val('Jun 25, 2012');
Run Code Online (Sandbox Code Playgroud)

导致空输入字段.上面的jQuery在ie7-9,chrome,safari和FF中运行得很好,但在iOS中却不行!

我没有想法.有谁知道一个工作?或者为什么会这样?

jquery html5 mobile-safari ipad

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

从内部获取用户代理

我试图将我为groovy写的脚本移植到jade上,并且遇到了绊脚石

我需要从jade文件中访问用户代理.这是我到目前为止所尝试的:

 - var agent = req.headers['user-agent'];
 - var agent = headers['user-agent'];
 - var agent = navigator.userAgent;
Run Code Online (Sandbox Code Playgroud)

每次我从快递得到500错误.这甚至可能吗?

我知道我可以在模块中执行它并将其传递给render语句,但这意味着将它传递给每个渲染,因为它需要是全局的.

节点很新,很困惑.谢谢你.

node.js express pug

9
推荐指数
1
解决办法
3476
查看次数