Skip to content

Instantly share code, notes, and snippets.

View landsman's full-sized avatar

Michal Landsman landsman

View GitHub Profile
// AJAX paging
jQuery('.pagination a').live('click',
function(e)
{
//check when pagination link is clicked and stop its action.
e.preventDefault();
var mainWrapper = '#page-content .container';
var mainContent = '#content';
var link = jQuery(this).attr('href'); //Get the href attribute
<?php
// CSV export Sunlight CMS for Wordpress, with plugin: https://wordpress.org/plugins/really-simple-csv-importer/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
/* --- kontrola jadra --- */
if(!defined('_core')) exit;
@landsman
landsman / functions.php
Last active August 2, 2016 00:03
Wordpress remove emoji from head, Woocommerce functions
// EMOJI
remove_action( 'wp_print_styles', 'print_emoji_styles');
remove_action( 'wp_head','print_emoji_detection_script', 7);
// GENERATOR
add_action( 'get_the_generator_html', '_fc_return_null', 10, 2 );
add_action( 'get_the_generator_xhtml', '_fc_return_null', 10, 2 );
function _fc_return_null(){
return null;
}
@landsman
landsman / localhostSetup.sh
Last active February 27, 2017 09:29
improve php limits config for development
# call this script on root permissions (ubuntu: sudo sh /path-to-file/localhostSetup.sh)
# upload limit
sed -i 's/post_max_size = 8M/post_max_size = 4000M/g' /etc/php/7.0/apache2/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 4000M/g' /etc/php/7.0/apache2/php.ini
# timeout from 30s to 1 half hour
sed -i 's/max_execution_time = 30/max_execution_time = 1800/g' /etc/php/7.0/apache2/php.ini
# error reporting
@landsman
landsman / localhostInstall.sh
Last active October 27, 2016 20:41
full lamp stack in one script + git + nodejs, currently in WIP
# readme: run on sudo (sudo /path-to-file/localhostInstall.sh)
# git
apt-get install git-all
# composer
apt install composer
# install apache
apt-get install apache2
@landsman
landsman / gist:10805cacd3ffe6b46c1d50aac03333f9
Created August 21, 2016 23:29
avocode install bash script
#!/bin/sh
BASEDIR=$(pwd)
FILE="~/.local/share/applications/avocode.desktop"
/bin/cat <<EOM >$FILE
[Desktop Entry]
Name=Avocode
Comment=The bridge between designers and developers
GenericName=Design Inspector
@landsman
landsman / gist:7e3741abd384f1606009cf02770cda9a
Created August 31, 2016 14:39 — forked from elcontraption/gist:4028550
WordPress change domain query
SET @old_domain = 'http://olddomain.com';
SET @new_domain = 'http://newdomain.com';
UPDATE wp_options SET option_value = replace(option_value, @old_domain, @new_domain) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, @old_domain, @new_domain);
UPDATE wp_posts SET post_content = REPLACE (post_content, @old_domain, @new_domain);
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, @old_domain, @new_domain);
@landsman
landsman / FormControl.php
Last active September 15, 2016 15:14
Prace s obrazkem uvnitr formulare bez manual render
<?php
namespace Nette\Forms\Controls;
use App\Components\Imager;
use Nette;
use Nette\Http\FileUpload;
use Nette\Utils\Html;
@landsman
landsman / .htaccess_nette
Last active January 29, 2017 23:01
Wordpress on same domain and url with other app
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
@landsman
landsman / makeBuild
Last active February 9, 2017 10:45
Drupal 8 make build bash script
#!/bin/bash
#################################################################
# Complete build script for Drupal 8 projects
# Author: Michal Landsman <michal.landsman@burda.cz>
#################################################################
# check bash version
if [ "${BASH_VERSION:0:1}" = "3" ]
then