Skip to content

Instantly share code, notes, and snippets.

@martinherweg
martinherweg / gist:194e2c31671ef1ee2626
Last active August 29, 2015 14:14
gulp sass with sourcemap
gulp.task('sass', function() {
gulp.src(['assets/scss/**/*.scss', '!assets/scss/templates/*.scss'])
.pipe(plumber({errorHandler: on_Error}))
.pipe(gulpif(condition, sass({require: ['susy'], style: 'expanded', sourcemap: true}), sass()))
.pipe(filter('**/*.css'))
.pipe(sourcemaps.init({loadMaps:true}))
.pipe(postcss([autoprefixer({ browsers: ['last 2 version', 'ie 9'], cascade: true})]))
.on('error', function(err) { console.log(err.message); })
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/css'))
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@martinherweg
martinherweg / browserSync.js
Last active May 29, 2021 08:07
Webpack + BrowserSync + HMR
/**
|--------------------------------------------------------------------------
| gulp browser-sync
|--------------------------------------------------------------------------
*
* Browser Sync
* @description Refresh the Brwoser after File Change.
* Combined with webpack for HMR or Content Reload
*
* @package generator-mh-boilerplate
@martinherweg
martinherweg / downloadCraftPlugins.js
Last active July 24, 2017 12:20
Allows you to install new Craft
/**
* Download Craft Plugins
*
* @package generator-mh-boilerplate
* @author Martin Herweg <info@martinherweg.de>
*/
const inquirer = require('inquirer');
const download = require('download');
const ProgressBar = require('progress');
@martinherweg
martinherweg / _moduleTmpl.js
Last active July 24, 2017 12:26
Create a Module in the Modules Folder
/*
|--------------------------------------------------------------------------
| <%= moduleName.replace('-', '_') %>
|--------------------------------------------------------------------------
*/
export default function() {
console.log('Initialize: <%= moduleName.replace('-', '_') %>');
}
@martinherweg
martinherweg / .babelrc
Last active August 3, 2017 19:26
webpack config with es2015 features
{
"presets":
[
"es2015"
]
}
@martinherweg
martinherweg / index.js
Created August 4, 2017 12:22
Jetbrains Request #1052740
// No kind of Autocomplete works for in these import styles
// Vue Lazyloading of Routes
const Confirmation = () => import(/* webpackChunkName: 'router-confirmation' */ 'Js/views/Confirmation.vue');
const Tnbs = () => import(/* webpackChunkName: 'router-tnbs' */ 'Js/views/Tnbs.vue');
const Privacy = () => import(/* webpackChunkName: 'router-privacy' */ 'Js/views/Privacy.vue');
// Normal Lazyloading as described in the webpack Documentation
// Autocomplete doesn't work eithe
import('Components/testFunction')
@martinherweg
martinherweg / DepartmentFile.json
Last active November 13, 2017 13:12
Create new Sections based on a Base JSON
{
"sections": [
{
"name": "A New Section",
"handle": "a_new_section_handle"
}
]
}
import chalk from 'chalk';
/**
|--------------------------------------------------------------------------
| gulp browser-sync
|--------------------------------------------------------------------------
*
* Browser Sync
* @description Refresh the Brwoser after File Change.
* Combined with webpack for HMR or Content Reload
@martinherweg
martinherweg / module.php
Created May 1, 2018 09:10
Craft Commerce 2 Extend Snapshots
Event::on(LineItems::class, LineItems::EVENT_POPULATE_LINE_ITEM, function (LineItemEvent $event) {
$purchasable = $event->lineItem->purchasable;
$lineItem = $event->lineItem;
$productImageUrl = '';
$imageOptimize = [];
if (count($purchasable->product->productImage) > 0) {
$productImageUrl = $purchasable->product->productImage->one()->getUrl();
if (Craft::$app->plugins->isPluginInstalled('image-optimize')) {