This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Shopware_Plugins_Frontend_GlassesStockVariant_Bootstrap extends Shopware_Components_Plugin_Bootstrap { | |
public function getCapabilities() { | |
return array( | |
'install' => true, | |
'update' => true, | |
'enable' => true | |
); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$db->setQuery($db->getQuery(true)->select("ID")->from($db->quoteName('#__table'))->where($db->quoteName('ID').' = '.$db->quote(1)))->loadObject()->ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tmpfile = tempnam("tmp", "zip"); | |
$zip = new ZipArchive(); | |
$zip->open($tmpfile, ZipArchive::CREATE | ZipArchive::OVERWRITE); | |
$files = [[$_SERVER['DOCUMENT_ROOT'].'/.../foo.txt','foo.txt'],[$_SERVER['DOCUMENT_ROOT'].'/.../bar.txt','bar.txt']]; | |
foreach($files as $files__value) { | |
$zip->addFile(($_SERVER['DOCUMENT_ROOT'].'/.../'.$files__value[0]), $files__value[1]); | |
} | |
$zip->close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, minimum-scale=1" /> | |
<title>.</title> | |
<style> | |
* | |
{ | |
box-sizing: border-box; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="slideshow" data-speed="1000" data-speed-manual="100" data-delay="10000" data-delay-init="1500" animation="fade" easing="easeInSine"> | |
<ul> | |
<li style="display:block;background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="display:none;background-image:url('http://lorempixel.com/g/640/480/people/');"></li> | |
<li style="display:none;background-image:url('http://lorempixel.com/g/640/480/nature/');"></li> | |
</ul> | |
</div> | |
<!-- enable this to turbo up sizing (no clipping on page load --> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~~(Math.random()*(y-x+1))+x | |
Explanation: | |
- Math.random(): [0, 1) | |
- Math.random()*(y-x+1): [0, y-x+1) | |
- (Math.random()*(y-x+1))+x: [x, y+1) | |
- ~~(Math.random()*(y-x+1))+x: [x, y] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = ['foo', 'bar', null, 'baz']; | |
delete a[1]; // ['foo', undefined, null, 'baz'] | |
a = a.filter(v => typeof v !== 'undefined'); // ['foo', null, 'baz'] | |
a = a.filter(v => v != 'baz'); // ['foo', null] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// current date | |
new Date(); | |
// date from string | |
new Date('2016-01-01'); | |
// date from string (german) | |
let str = '01.01.2016'; | |
new Date(str.substring(6,10)+'-'+str.substring(3,5)+'-'+str.substring(0,2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// es6 | |
function foo(a,b = 2) { | |
alert(a+b); | |
} | |
// pre es6 | |
function foo(a,b) { | |
b = b || 2; | |
alert(a+b); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = $.grep(array, function(v, k){ return $.inArray(v ,array) === k; }); |
OlderNewer