小编tie*_*enb的帖子

nginx:重定向从http到https的所有内容,除了一个url-pattern

我有一个只能通过HTTPS访问的网站,除了一个URL模式(因为我在某些页面上有http-iframe,我想避免安全警告)

E.g. this pages should be redirected to https:
http://example.com
http://example.com/a/this-is-an-article
http://example.com/v/this-is-a-video

This pages should not be redirected to https (or should be redirected form https to http)
http://example.com/l/page-with-unsafe-iframe
http://example.com/l/other-page-with-unsafe-iframe
Run Code Online (Sandbox Code Playgroud)

nginx

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

汇总错误:node_modules/react/index.js 未导出“默认”

我有一个项目,我使用 webpack 并想切换到 rollup.js,但是我在插件 @rollup/plugin-commonjs 方面遇到了麻烦。

我的 rollup.conf.js

import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import nodePolyfills from 'rollup-plugin-node-polyfills';

const config = {
    input: 'site/templates/scripts/master.js',
    output: [
        {
            file: 'site/templates/scripts/master.min.js',
            format: 'cjs'
        }
    ],
    plugins: [
        nodePolyfills(),
        resolve({
            browser: true
        }),
        commonjs({
            include: /node_modules/,
            namedExports: {
                'react': ["useState", "useEffect"],
                '@apollo/client': ['ApolloProvider', 'ApolloClient', 'HttpLink', 'InMemoryCache', 'useQuery', 'gql'],
                'styled-components': [ 'styled', 'css', 'ThemeProvider' ]
            }
        }),
        babel({
            babelrc: true,
            exclude: 'node_modules/**' …
Run Code Online (Sandbox Code Playgroud)

javascript commonjs ecmascript-6 reactjs rollupjs

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

LevelDB是密钥的最大长度限制吗?

LevelDB密钥是否有密钥长度的限制?

我想用url作为密钥来保存数据.因此,这些网址可能会非常长ig整体http: // veryveryfvery very very a长度非常长,非常浪费.每个人都可以从不是每个人都非常友好

nosql leveldb

8
推荐指数
1
解决办法
3026
查看次数

Smarty registerPlugin函数作为参数

在Smarty中,可以通过这种方式注册插件:

$smarty->registerPlugin("function","date_now", "print_current_date");

function print_current_date($params, $smarty)
{
  if(empty($params["format"])) {
    $format = "%b %e, %Y";
  } else {
    $format = $params["format"];
  }
  return strftime($format,time());
}
Run Code Online (Sandbox Code Playgroud)

参考:https://www.smarty.net/docs/en/api.register.plugin.tpl

但我正在寻找一种方法,我可以直接传递函数作为参数.我怎么能在PHP/Smarty中做到这一点?

例如:

$smarty->registerPlugin("function","date_now", function ($params, $smarty) {
  if(empty($params["format"])) {
    $format = "%b %e, %Y";
  } else {
    $format = $params["format"];
  }
  return strftime($format,time());
});
Run Code Online (Sandbox Code Playgroud)

php smarty smarty3 smarty-plugins

8
推荐指数
1
解决办法
229
查看次数

在dust.js中格式化数字和日期(linkedin-fork)

如何在dust.js模板中格式化数字,货币或日期值?

数据:

{
today: 'Wed Apr 03 2013 10:23:34 GMT+0200 (CEST)'
}
Run Code Online (Sandbox Code Playgroud)

模板:

<p>Today: {today} </p>
Run Code Online (Sandbox Code Playgroud)

像这样:(与moment.js)

<p>Today: {moment(today).format('dd.MM.YYYY')}</p>
Run Code Online (Sandbox Code Playgroud)

或者围绕一些价格值*

数据:{价格:56.23423425}

模板:

价格:{price.toFixed(2)}

javascript client-side-templating dust.js

6
推荐指数
1
解决办法
5066
查看次数

6
推荐指数
2
解决办法
3685
查看次数

路由器上的 NodeJs 通过 DD-WRT 还是 OpenWRT?

知道的人,我如何在 dd-wrt、openwrt 或 freewrt 系统上安装 NodeJS?

或者也许在这些系统上的任何路由器上:http : //en.wikipedia.org/wiki/List_of_router_or_firewall_distributions

linux openwrt node.js dd-wrt

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

无法在JavaScript中删除RegExp.$ 1

任何人都知道为什么RegExp.$ 1-x变量不能设置为undefined?

以下是nodejs中的示例.chrome/firefox中的行为相同:

console.log('1:', RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4); 
// 1: / Users/tiefenma/Desktop/ test.js .js

var string = 'test1 test2 test3';
var test = string.match(/(test1).*(test2).*(test3)/gm);


console.log('2:', RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4);
// 2: test1, test2, test3


RegExp.$1 = undefined;
RegExp.$2 = undefined;
RegExp.$3 = undefined;
console.log('3:', RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4);
// 3: test1, test2, test3


delete RegExp.$1;
delete RegExp.$2;
delete RegExp.$3;
console.log('4:', RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4);
// 4: test1, test2, test3


''.match(/(.*)/g);
console.log('5:', RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4);
// 5:
Run Code Online (Sandbox Code Playgroud)

javascript regex node.js

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

docker-sync:找不到命令

$ gem install docker-sync

ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.5.0/gems/docker-sync-0.5.9/Thorfile

$ sudo gem install docker-sync

Successfully installed docker-sync-0.5.9
Parsing documentation for docker-sync-0.5.9
Done installing documentation for docker-sync after 0 seconds
1 gem installed

$ docker-sync
-bash: docker-sync: command not found
Run Code Online (Sandbox Code Playgroud)

我曾尝试在 Mac OSX 10.14.2 上安装 docker-sync,但 bash 从未找到该命令。重启后也不行。我能做什么?

bash rubygems docker

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