Skip to content

Instantly share code, notes, and snippets.

View twesolowski's full-sized avatar

Tom Woo twesolowski

View GitHub Profile
@twesolowski
twesolowski / webp-search-generate.php
Created October 8, 2020 09:08
Finds jpg and png files, creates webp files
<?php
if (!extension_loaded('gd') || !function_exists('gd_info')) {
die("Missing gd!\n");
}
$gd = gd_info();
if (!$gd["WebP Support"]){
die("webp not supported");
}
@twesolowski
twesolowski / readme.md
Created September 11, 2018 12:44
jashdatalayer

README

DataLayer on every page

dataLayer.push({
    "siteType": "desktop",
    "event": "contact",
    "language": "en",
    "currency": "GBP"
var util = {};
util.post = function(url, target, fields) {
var $form = $('<form>', {
action: url,
target : target,
method: 'post'
});
$.each(fields, function(key, val) {
$('<input>').attr({
type: "hidden",
@twesolowski
twesolowski / manufacturer_delete
Created July 28, 2017 07:32
Prestashop API ps_method
POST /ps1616/api/manufacturers/1?ps_method=DELETE HTTP/1.1
Host: localhost
Authorization: Basic WFhKQlZZWkQyTkQ1REs1M1NaNlVUWEE3SFk3SFFVOEI6
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: b762ee57-682a-e228-7331-00c863f661d9
@twesolowski
twesolowski / readme.md
Created July 24, 2017 06:42
Jash Data Layer

README

DataLayer on every page

dataLayer.push({
    "siteType": "desktop",
    "event": "contact",
    "language": "en",
    "currency": "GBP"
@twesolowski
twesolowski / Docekrfile
Created July 14, 2017 10:22
Docker sass
# TODO: pin versions
FROM alpine
MAINTAINER Tomasz Wesolowski "tomek@wesolowski.it"
RUN set -ex \
&& apk add --update --no-cache ruby \
&& apk add --update --no-cache --virtual build-dependencies \
build-base \
ruby-dev \
libffi-dev \
@twesolowski
twesolowski / .htaccess
Created June 21, 2017 09:39
Disable mod_security
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
@twesolowski
twesolowski / index.html
Created May 11, 2017 12:26 — forked from liuyanghejerry/index.html
Modern index file in 2017
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#">
<head>
<!-- content-type, which overrides http equivalent header. Because of charset, this meta should be set at first. -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Overrides http equivalent header. This tells IE to use the most updated engine. -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<!-- Tells crawlers how to crawl this page, and the role of this page. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta -->
<meta name="robots" content="index, follow">
@twesolowski
twesolowski / phpunit.xml
Created March 15, 2017 10:08
phpunit.xml for PrestaShop module
<phpunit
bootstrap="../../config/config.inc.php"
colors="true">
<testsuites>
<testsuite name="module">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
@twesolowski
twesolowski / TemplateMethodsTest.php
Created March 15, 2017 10:04
PHPUnit Template Methods Test
<?php
use PHPUnit\Framework\TestCase;
class TemplateMethodsTest extends TestCase
{
public static function setUpBeforeClass()
{
fwrite(STDOUT, __METHOD__ . "\n");
}