Skip to content

Instantly share code, notes, and snippets.

@kopitar
kopitar / warm.sh
Created May 16, 2023 06:48 — forked from pkdavies/warm.sh
Cache warming script using siege
#!/bin/bash
rm sitemap.xml
wget -q https://www.CLIENT.com/sitemap.xml
sed '/<loc>/!d; s/[[:space:]]*<loc>\(.*\)<\/loc>/\1/' sitemap.xml > links.txt
siege -b -v -c 10 -f links.txt -r once -H 'Accept-Encoding: gzip' 2>/dev/null
@kopitar
kopitar / regions_IT.sql
Created March 29, 2023 14:21
Magento 1.x.x - regions for Italy
INSERT INTO `directory_country_region` (`region_id`, `country_id`, `code`, `default_name`) VALUES
(NULL, 'IT', 'ABR', 'Abruzzo'),
(NULL, 'IT', 'VAL', 'Valle d\'Aosta'),
(NULL, 'IT', 'PUG', 'Puglia'),
(NULL, 'IT', 'BAS', 'Basilicata'),
(NULL, 'IT', 'CAL', 'Calabria'),
(NULL, 'IT', 'CAM', 'Campania'),
(NULL, 'IT', 'EMI', 'Emilia-Romagna'),
(NULL, 'IT', 'FRI', 'Friuli-Venezia Giulia'),
(NULL, 'IT', 'LAZ', 'Lazio'),
@kopitar
kopitar / resize_image.php
Last active June 5, 2020 03:13 — forked from janzikan/resize_image.php
PHP: Resize image - preserve ratio of width and height
/**
* Resize image - preserve ratio of width and height.
* @param string $sourceImage path to source JPEG/PNG image
* @param string $targetImage path to final JPEG/PNG image file
* @param int $maxWidth maximum width of final image (value 0 - width is optional)
* @param int $maxHeight maximum height of final image (value 0 - height is optional)
* @param int $quality quality of final image (0-100)
* @return bool
*/
function resizeImage($sourceImage, $targetImage, $maxWidth, $maxHeight, $quality = 80)
@kopitar
kopitar / ie.html
Last active November 6, 2018 07:33
Internet Explorer - targeting by Media queries and conditional statements
***********************************************
TARGET BY MEDIA QUERIES:
<!-- IE10 & IE 11 -->
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
<!-- IE10 -->
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
@kopitar
kopitar / gist:e97d35506febcc1ecae68d1adcd894d4
Created September 18, 2018 12:14
PHP: minimal example of SOAP Server and Client
<?php
// server
class MySoapServer
{
public function getMessage()
{
return 'Hello,World!';
}