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
.tabs__header-tab.is-active { | |
// Some active styles for header | |
} | |
.tabs__content { | |
display: none; // Hide tab content | |
} | |
.tabs__content.is-active { | |
display: block; // And show only active |
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
const fs = require('fs'); | |
const path = require('path'); | |
function removeAccents(str) { | |
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); | |
} | |
function kebabCase(str) { | |
return str | |
.replace(/[^\w\s-]/g, '') // Remove non-Latin characters and keep spaces and hyphens |
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
document.getElementsByTagName('button')[0].onclick = function () { | |
scrollTo(document.body, 0, 1250); | |
} | |
function scrollTo(element, to, duration) { | |
var start = element.scrollTop, | |
change = to - start, | |
currentTime = 0, | |
increment = 20; | |
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
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"> | |
<meta name=apple-mobile-web-app-capable content=yes> | |
<meta name=apple-mobile-web-app-status-bar-style content=black> | |
<meta name="googlebot" content="index,follow,snippet,archive"> | |
<meta name="robots" content="index,follow"> | |
<meta name="description" content="#"> | |
<meta name="keywords" content="#"> | |
<meta name="author" content="#"> |
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
$server = $this->getRequest()->getServer(); | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_POST, true); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl, CURLOPT_TIMEOUT, 90); // times out after 90s | |
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); |
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
// in controller action | |
$this->_helper->viewRenderer->setNeverRender(); | |
$this->_helper->layout()->disableLayout(); |
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
$this->_helper->redirector->gotoRouteAndExit(array(), 'backend-module-controller'); | |
$params = array(); | |
$this->forward('denied', 'error', 'default', $params); | |
return; |
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
$translator = $this->view->getHelper('translate')->getTranslator(); | |
$translator->setLocale($order->getLanguage()->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
<?php | |
// STEP 1: read POST data | |
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. | |
// Instead, read raw POST data from the input stream. | |
$raw_post_data = file_get_contents('php://input'); | |
$raw_post_array = explode('&', $raw_post_data); | |
$myPost = array(); | |
foreach ($raw_post_array as $keyval) { | |
$keyval = explode ('=', $keyval); |
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
NUMBER FORMAT: | |
return number_format((float)$number, 2, '.', ''); | |
SPRINTF: | |
$padded = sprintf('%0.2f', $unpadded); // 520 -> 520.00 | |
ROUND: | |
<?php | |
echo round(3.4); // 3 | |
echo round(3.5); // 4 |
NewerOlder