This file contains hidden or 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
/* -------------------------------------------- | |
* Detect device orientation | |
* and trigger changes based on it | |
--------------------------------------------*/ | |
function updateOrientation() { | |
// Detect whether device supports orientationchange event, otherwise fall back to the resize event | |
// Genius solution from http://stackoverflow.com/a/2307936 | |
let supportsOrientationChange = "onorientationchange"; | |
let orientationEvent = supportsOrientationChange ? "orientationchange" : "resize"; | |
let newAngle = null; |
This file contains hidden or 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
# Delete all logs | |
TRUNCATE ps_log; | |
# Delete old connection data (only used for stats) | |
# change 2016-02-01 00:00:00 according to you needs | |
DELETE c, cs | |
FROM ps_connections c | |
LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections) | |
WHERE c.date_add < '2016-02-01 00:00:00'; |
This file contains hidden or 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
SELECT | |
p.id_product, | |
pa.reference, | |
pa.upc, | |
pa.price, | |
pai.id_image, | |
pl.name, | |
GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ", ") as combination, | |
pq.quantity | |
FROM ps_product p |
This file contains hidden or 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 AdminCmsController extends AdminCmsControllerCore | |
{ | |
public function renderForm() | |
{ | |
if (!$this->loadObject(true)) { | |
return; | |
} |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or 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
ID;Active (0/1);Name *;Parent category;Root category (0/1);Description;Meta title;Meta keywords;Meta description;URL rewritten;Image URL | |
100;1;Normal;Home;0;;Meta title-normal;Meta keywords-normal;Meta description-normal;normal;http://cdn.bulbagarden.net/upload/e/e4/NormalIC.gif | |
101;1;Fighting;Home;0;;Meta title-fighting;Meta keywords-fighting;Meta description-fighting;fighting;http://cdn.bulbagarden.net/upload/8/8e/FightingIC.gif | |
102;1;Flying;Home;0;;Meta title-flying;Meta keywords-flying;Meta description-flying;flying;http://cdn.bulbagarden.net/upload/7/73/FlyingIC.gif | |
103;1;Poison;Home;0;;Meta title-poison;Meta keywords-poison;Meta description-poison;poison;http://cdn.bulbagarden.net/upload/7/71/PoisonIC.gif | |
104;1;Ground;Home;0;;Meta title-ground;Meta keywords-ground;Meta description-ground;ground;http://cdn.bulbagarden.net/upload/d/d9/GroundIC.gif | |
105;1;Rock;Home;0;;Meta title-rock;Meta keywords-rock;Meta description-rock;rock;http://cdn.bulbagarden.net/upload/1/15/RockIC.gif | |
106;1;Bug;Home;0;;Meta title- |
This file contains hidden or 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 AdminCartRulesController extends AdminCartRulesControllerCore | |
{ | |
protected function afterAdd($currentObject) | |
{ | |
/* | |
* Omitted code... | |
*/ |
This file contains hidden or 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
find . -name "*.png" -exec optipng '{}' \; | |
find . -name "*.jpg" -exec jpegoptim '{}' \; |
This file contains hidden or 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 Media extends MediaCore | |
{ | |
public static function deferScript($matches) | |
{ | |
if (!is_array($matches)) | |
return false; | |
$inline = ''; | |
if (isset($matches[0])) |
This file contains hidden or 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 SecureSessionHandler extends SessionHandler { | |
protected $key, $name, $cookie; | |
public function __construct($key, $name = 'MY_SESSION', $cookie = []) | |
{ | |
$this->key = $key; | |
$this->name = $name; |
This file contains hidden or 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
// Determine if an element is in the visible viewport | |
function isInViewport(element) { | |
var rect = element.getBoundingClientRect(); | |
var html = document.documentElement; | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || html.clientHeight) && | |
rect.right <= (window.innerWidth || html.clientWidth) | |
); |