Skip to content

Instantly share code, notes, and snippets.

View timneutkens's full-sized avatar
👋

Tim Neutkens timneutkens

👋
View GitHub Profile
@timneutkens
timneutkens / config-load-data-infile.yml
Created July 4, 2016 08:24
Enable LOAD DATA INFILE Symfony Doctrine
doctrine:
dbal:
option:
# This is PDO::MYSQL_ATTR_LOCAL_INFILE
1001: true
@timneutkens
timneutkens / countposts.php
Created July 11, 2016 12:57
WPML wp_count_posts fix. Taken from http://pastebin.com/E5nMcF25
function count_posts($language_code = '', $post_type = 'post', $post_status = 'publish'){
global $sitepress, $wpdb;
//get default language code
$default_language_code = $sitepress->get_default_language();
//adjust post type to format WPML uses
switch($post_type){
case 'page':
@timneutkens
timneutkens / findtypekitfonts.js
Created July 15, 2016 07:31
Find typekit fonts. Run this in your console.
$('html').attr('class')
.split(' ')
.filter( function (word) {
return word.match(/wf-(.*)-active/g); }
)
.forEach( function (font) {
console.log(font.replace(/wf-|-active/g, ''))
})
@timneutkens
timneutkens / jquery-ui-accordion-opened-tab-scroll.js
Created July 19, 2016 10:26
jQuery UI accordion scroll to clicked tab
function scrollTo(element) {
jQuery('html, body').animate({
scrollTop: jQuery(element).offset().top
}, 500);
}
jQuery('.accordion').on('accordionactivate', function( event, ui ) {
scrollTo(jQuery(event.target).find('.ui-accordion-header-active'))
});
@timneutkens
timneutkens / swiper.css
Last active July 22, 2016 07:43
Swiper.js horizontal slider styling
.swiper-container {
position: relative;
overflow: hidden;
width: 100%;
}
.swiper-wrapper {
position: relative;
width: 10000%;
}
@timneutkens
timneutkens / .vimrc
Created July 23, 2016 12:02
Enable vim syntax highlighting for mac
filetype plugin indent on
syntax on
@timneutkens
timneutkens / validation-classes.js
Last active August 7, 2016 13:44
Magento2 get javascript validation classes like validate-number etc. can be ran on front-end and admin panel
(function() {
var exec = false;
if(typeof requirejs !== 'undefined') {
exec = requirejs;
} else if (typeof require !== 'undefined') {
exec = require;
} else {
console.log('require.js not found');
return false;
}
@timneutkens
timneutkens / .my.cnf
Last active August 15, 2016 07:53
~/.my.cnf mysql username and password.
[client]
user=mysqluser
password=mysqlpass
host=localhost
@timneutkens
timneutkens / ip.sh
Created August 15, 2016 11:47
Get your external IP adress
alias ip='dig +short myip.opendns.com @resolver1.opendns.com'
@timneutkens
timneutkens / catalog_product_view.xml
Created August 23, 2016 09:23
Remove reviews from product page Magento 2
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.review" remove="true" />
<referenceBlock name="reviews.tab" remove="true" />
</body>
</page>