This file contains 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 | |
if ( $_SERVER['HTTP_HOST'] != 'localhost' ) { | |
die( 'Only locally enabled! change import-csv.php.' ); | |
} | |
$csv = filter_input( INPUT_GET, 'csv' ); | |
if ( ! $csv ) { | |
?> | |
<form> |
This file contains 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
jQuery(function ($) { | |
var $headings = $('h1, h2, h3', '#content'); | |
var $h2 = $('h2', '#content'); | |
// Only if two or more level 2 headings. | |
// and if content is larger then window. | |
if (($h2.length > 1 || $headings.length > 6) && $('#content').height() > $(window).height() * 1.25) { | |
var $nav = $('<nav>').attr('id', 'toc'); | |
$nav.insertAfter('#sidebar'); |
This file contains 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
echo off | |
set dbUser=root | |
set dbPassword=mysql | |
set backupDir="C:\Users\Ruben\PhpstormProjects\mysql backup" | |
:: set mysqldump="C:\Program Files (x86)\Ampps\mysql\bin\mysqldump.exe" | |
set mysqldump="C:\Users\Ruben\Desktop\UwAmp\bin\database\mysql-5.6.20\bin\mysqldump.exe" | |
set mysqlDataDir="C:\Users\Ruben\Desktop\UwAmp\bin\database\mysql-5.6.20\data" | |
set zip="C:\Program Files\7-Zip\7z.exe" |
This file contains 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 | |
// add all woocommerce product categories to body_class | |
function product_category_body_classes( $classes ){ | |
if( is_singular( 'product' ) || is_tax( 'product_cat' ) ) { | |
foreach (get_the_terms(0, 'product_cat') as $custom_term) { | |
do { | |
$classes[] = 'product-category-' . $custom_term->slug; | |
//if( is_singular( 'product' ) ) { | |
$classes[] = 'term-' . $custom_term->term_id; |
This file contains 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
(function () { | |
'use strict'; | |
var gulp = require('gulp'), | |
header = require('gulp-header'), | |
sass = require('gulp-sass'), | |
sourcemaps = require('gulp-sourcemaps'), | |
cssmin = require('gulp-cssmin'), | |
rename = require('gulp-rename'), | |
uglify = require('gulp-uglify'), |
This file contains 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 | |
/** @var string $path The path, for example 'services/webdevelopment/wordpress' **/ | |
// all page rows are expected to have a slug value. | |
$path_parts = preg_split('@/+@', trim($path, '/')); | |
$joins = array(); | |
$where = array(); | |
$select = array(sprintf('a%d.*', count($path_parts))); |
This file contains 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 | |
// magic quotes fix. | |
$app->after(function ( | |
\Symfony\Component\HttpFoundation\Request $request, | |
\Symfony\Component\HttpFoundation\Response $response | |
) { | |
$content_type = $response->headers->get('content-type'); | |
if (strpos($content_type, 'text/html') === 0) { | |
$response->setContent(preg_replace_callback('@(?<attribute>[a-z0-9]+)=(\\\\(?<enclosure>["|\']))(?<value>[^"\']+)\2@i', |
This file contains 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 | |
/** | |
* @param string $string | |
* @param array $replacements | |
* @param string $begin | |
* | |
* @return string | |
* | |
* @example "string_format_example.php" | |
*/ |
This file contains 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
define(['jquery','bootstrap-validator'], function ($) { | |
// add a help block if one doesnt exist yet. | |
$('form:not(.no-validator) .form-group').each(function () { | |
var $group = $(this); | |
if (!$group.find('.help-block.with-errors').length) { | |
if (!$group.find('.help-block').addClass('with-errors').length) { | |
$group.find('div').last().append('<div class="help-block with-errors"></div>'); | |
} |
This file contains 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 | |
$specialchars = | |
array( | |
"\t" => '_', | |
"\r" => '_', | |
"\n" => '_', | |
' ' => '_', | |
':' => '.', | |
'`' => '' |