Skip to content

Instantly share code, notes, and snippets.

View landsman's full-sized avatar

Michal Landsman landsman

View GitHub Profile
@landsman
landsman / snippet.php
Created March 6, 2017 00:45
Joomla parse shortcode for import
<?php
function findBetween($string, $tag) {
$regex = '#{'.$tag.'}(.*?){/'.$tag.'}#';
preg_match($regex, $string, $matches);
return isset($matches[1]) ? $matches[1] : null;
}
$string = '["{mp4}LB_tr2min_w{\/mp4}"]';
$result = json_decode($string);
@landsman
landsman / developer.sh
Last active March 19, 2017 23:02
Developer stuffs on macOS by one command :-) --- In progress
# todo: questions like: Are you using drupal, wordpress, etc and install their CLI
# create working dir
mkdir developer-tmp
# brew
echo "Install Brew manager"
ruby \
-e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
@landsman
landsman / crosspromo.js
Created March 19, 2017 22:10
vanilla javascript loading html content async
function loadBlocks()
{
var crosspromoSites = [
'elle',
'marieclaire',
'apetitonline',
'svetzeny'
];
var parentElement = document.getElementById('crosspromo');
@landsman
landsman / script.js
Last active April 9, 2017 17:59
CSS in Javascript :-)
/**
* Merge deep objects
* Credit: http://stackoverflow.com/a/20591261/3783469
* @param target
* @returns {*}
*/
function BD_Extend(target) {
for(var i=1; i<arguments.length; ++i) {
var from = arguments[i];
if(typeof from !== 'object') continue;
@landsman
landsman / svg_allow.xml
Last active April 13, 2018 15:13
Opencart 2.x SVG support for upload, logo
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>SVG allow upload, logo</id>
<version>0.1</version>
<vqmver required="true">2.6.0</vqmver>
<author>Michal Landsman</author>
<file path="admin/controller/common/filemanager.php">
<operation info="add svg">
<search position="replace">
@landsman
landsman / squash-commits.sh
Created July 26, 2017 13:56 — forked from jbub/squash-commits.sh
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c
@landsman
landsman / start.bat
Created August 8, 2017 14:07 — forked from jbutko/start.bat
Git: Merge redundand commits into one
git reset --soft HEAD~7
git commit -m "Add stickyNavbar.js"
git push --force
REM From https://github.com/jsdelivr/jsdelivr/pull/843
@landsman
landsman / ScriptHandler.php
Last active August 18, 2018 15:29
OpenCart npm-based theme deployment
<?php
namespace BurdaPraha\composer;
use Composer\Script\Event;
use Composer\Util\ProcessExecutor;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Console\Helper\Table;
@landsman
landsman / _mixins.scss
Created August 21, 2017 18:51
SASS ripple effects Android
//
// "watter" effects for buttons
//
@mixin ripple {
position: relative;
overflow: hidden;
transform: translate3d(0, 0, 0);
&:after {
@landsman
landsman / bbelements.html
Last active September 21, 2017 15:06
bbelements async loading
<!--
je treba na strance vytvorit pozice ve stylu:
<div id='branding_1829391' data-bbelements-id="21812.1.2.9"></div>
kdy identifikator elementu je vzdy unikatni, nejlepe generovany z CMS
-->
<script id='ibbTagEngine' src='https://bbcdn-static.bbelements.com/scripts/ibb-async/stable/tag.js'></script>