我正在尝试实现一个glob允许我满足以下条件的同步模式,但不幸的是,我很难解决为什么模式不起作用.
全球模式
glob.sync("./src/handlebar/{a, b, c, d}/**/*.hbs")
文件路径模式
src/handlebar/b/a/header.hbs
src/handlebar/b/header.hbs
src/handlebar/a/head.hbs [MATCH]
src/handlebar/a/foot.hbs [MATCH]
src/handlebar/c/a/something.hbs
src/handlebar/d/a/button.hbs
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我试图找出使用多个排序规则进行字符串替换的最佳方法.
我有一个由用户插入的句子,我有一个数组,其中包含该句中所有拼写错误的单词及其可能的更正.
$sentence = 'i want to recovary my vehical from the cabs';
我想显示以下内容:
代码到目前为止:
$element = array(
"vehical" => array('vehicle'),
"recovary" => array('recovery', 'recover', 'revary')
);
$sentence = 'i want to recovary my vehical from the cabs';
foreach($element as $i => $val){
echo $i;
}
Run Code Online (Sandbox Code Playgroud)
编辑:扩展了另一种情况:
如果顶部数组中存在多个变体,会发生什么.
"vehical" => array('vehicle', 'vehiclesy', 'whatever'),
"recovary" => array('recovery', 'recover', 'revary')
Run Code Online (Sandbox Code Playgroud)
我目前正在手动执行bash命令,方法是在python代码中输入shell.
如何用pythonic方式做到这一点?
我目前正在使用os.system函数执行命令,如;
os.system('sudo add-apt-repository ppa:ondrej/php')
os.system('sudo apt-get update')
os.system('sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0')
os.system('sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart')
Run Code Online (Sandbox Code Playgroud) 我有一个函数,其中一个值插入到另一个函数中的变量中.
初始化:
当窗口调整大小时,它会触发resizeImage()函数.
$(window).resize(function () {
resizeImage();
});
Run Code Online (Sandbox Code Playgroud)
调整功能:
此函数使用image-resize类检查每个元素,并通过更改宽度值(来自scene7的动态)添加readjust图像的SRC.
问题是element.attr('src',newSrc); newSrc不存在,因为它存储在sizingMethod()中.
无论如何从sizingMethod()函数中获取变量并将其放在element.attr('src',newSrc)中; .
function resizeImage() {
$('.image-resize').each(function () {
var element = $(this), src = $(this).attr('src'), regx = /wid=\d+(\.\d)*/g, currentWidth, newWidth, newSrc;
var attrElement = $(this), attrSrc = $(this).attr('data-zoom-image'), attrRegex = /wid=\d+(\.\d)*/g, attrCurrentWidth, attrNewWidth, attrNewSrc;
if ($(window).width() > 1824) {
sizingMethod(src, regx, currentWidth, newWidth, newSrc, '2000');
} else if ($(window).width() <= 1824 && $(window).width() > 1366) { …Run Code Online (Sandbox Code Playgroud) 当前示例使用伪类来绘制具有主要标题和子标题的小元素的行.每个具有类的元素line都需要在左侧有一条线.
问题:我不得不增加高度200%以使其工作.当内容增加时,该行进一步延伸.
一旦内容增加,时间表就会进一步扩展:https://jsfiddle.net/ss189uva/
是否有可能实现这一目标jquery?因为这需要足够灵活以承受内容区域并自动调整.
原始示例:
p {
margin: 0;
padding: 0;
}
.view-timeline-block {
padding: 0 5em;
line-height: 28px;
}
.view-timeline-block .ml-container {
padding-left: 25px;
}
.view-timeline-block .line {
position: relative;
}
.view-timeline-block .line:after {
background: black none repeat scroll 0 0;
content: "";
height: 200%;
left: -19px;
position: absolute;
top: -15px;
width: 5px;
}
.view-timeline-block .active {
position: relative;
}
.view-timeline-block .active:after {
background-color: white;
border: 5px solid …Run Code Online (Sandbox Code Playgroud)我目前有一个抽象类,我将其扩展到其他控制器。我在抽象类中有一个抽象函数,它接受值并将它放在__construct.
abstract class Controller extends BaseController {
abstract public function something();
public function __construct(Request $request) {
if (!is_null($this->something())){
$this->global_constructor_usse = $this->something();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,在不需要这个抽象函数的控制器上,我不得不放置在空函数中。
class ControllerExample extends Controller {
public function something(){
return 'somethinghere';
}
}
Run Code Online (Sandbox Code Playgroud)
无论如何使抽象函数可选或具有默认值?
class EmptyControllerExample extends Controller {
public function something(){}
}
Run Code Online (Sandbox Code Playgroud)
或者最好的方法是什么?
我正在努力研究将jenkins的变化推向aws的自动化过程.问题似乎是在GIT回购中,我有2个文件夹,一个是docroot,另一个是database.我需要docroot进入/var/www/html和数据库现在应该被忽略.
作为试运行,我正在尝试以下设置:
设置1:
后期制作行动
转移集
Source files: **/*
Remove prefix: empty
Remote directory: empty
Exec command: pwd
Run Code Online (Sandbox Code Playgroud)
结果:错误:发布时出现异常,异常消息[无法创建或更改目录.目录[数据库]]构建步骤'通过SSH发送构建工件'将构建结果更改为不稳定完成:不稳定
设置2:
后期制作行动
转移集
Source files: **/*
Remove prefix: empty
Remote directory: /var/www/html
Exec command: pwd
Run Code Online (Sandbox Code Playgroud)
结果:错误:发布时出现异常,异常消息[无法创建或更改目录.目录[var]]构建步骤'通过SSH发送构建工件'将构建结果更改为UNSTABLE Finished:UNSTABLE
所有错误似乎都围绕创建目录 - 但我不需要创建一个...
我对当前尝试访问的API的加密有以下要求:
每次我使用加密提交API时,API似乎都有问题(遗憾的是没有产生错误).
$Data = "GOOD!";
$aesKey = "1234567812345678";
$EncryptedData = encrypt($aesKey,$Data);
$DecryptedData = decrypt($aesKey,$EncryptedData);
echo "Orignal Data : ". $Data;
echo "<br/>";
echo "After encryption = ". $EncryptedData;
echo "<br/>";
echo "After decryption = " .$DecryptedData;
function encrypt($aesKey, $dataToEncrypt) {
$output = false;
$iv = '{{{{{{{{{{{{{{{{';
$output = openssl_encrypt($dataToEncrypt, 'AES-128-CBC', $aesKey,
OPENSSL_RAW_DATA, $iv);
$output = base64_encode($output);
return $output;
}
function decrypt($aesKey, $dataTodecrypt) {
$output = false;
$iv = '{{{{{{{{{{{{{{{{';
$dataTodecrypt = base64_decode ($dataTodecrypt);
$dataTodecrypt = $output = …Run Code Online (Sandbox Code Playgroud) 我目前正在使用 webpack 并运行一项测试,该测试会遍历 node_modules 并排除一个特定模块。
然而,当我在正则表达式检查器上尝试它时,我正在努力处理正则表达式,并且它工作得很好。然而,在 webpack 上却失败了。
示例: https: //regex101.com/r/rO4jD0/34
^node_modules\/(?!example).*
Run Code Online (Sandbox Code Playgroud)
在 webpack 本身上,我编写以下内容:
vendor: {
test: /^[\\/]node_modules[\\/](?!example).*[\\/]/,
// test: /^[\\/]node_modules[\\/](?!example)[\\/].*/,
// test: /^node_modules\/(?!example).*/,
name: 'vendor',
chunks: 'all',
}
Run Code Online (Sandbox Code Playgroud)
这些测试是我迄今为止运行的测试的示例,但不幸的是它们都失败了。
仅供参考- 这工作正常,但它不排除该示例文件夹。
test: /[\\/]node_modules[\\/]/,
Run Code Online (Sandbox Code Playgroud) 我目前有一个滑块,我想从当前幻灯片实现动态类.
例:
[PAST 2, PAST 1, PAST 0] [CURRENT] [FUTURE 0, FUTURE 1, FUTURE 2]
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止的代码,未来似乎工作正常,但我似乎无法理解过去的元素.
var dumb = 0;
$('ul li').each(function(i){
var current = 2;
if(!$(this).hasClass('slick-current')){
if(i <= current){
$(this).addClass('past-' + i);
}
else {
$(this).addClass('future-' + dumb++);
}
console.log(i);
}
});Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<ul class="slick-initialized slick-slider">
<div aria-live="polite" class="slick-list draggable" style="padding: 0px 60px;">
<div class="slick-track" role="listbox">
<li id="pig" data-number="0" class="slick-slide slick-center" data-slick-index="0" aria-hidden="true" tabindex="-1" role="option" aria-describedby="slick-slide00">
<div class="character-name">Pig</div>
</li>
<li id="trayaurus" data-number="1" class="slick-slide" data-slick-index="1" aria-hidden="true" tabindex="-1" role="option" aria-describedby="slick-slide01"> …Run Code Online (Sandbox Code Playgroud)