Skip to content

Instantly share code, notes, and snippets.

View toh82's full-sized avatar

Tobias Hartmann toh82

View GitHub Profile
@toh82
toh82 / SassMeister-input.scss
Created September 18, 2014 12:13
SCSS get value from List
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
$list: 10px, 15px, 20px;
@function getListEntry ($list, $index) {
@if length($list) >= $index {
@return nth($list, $index);
@toh82
toh82 / gulp-config.json
Created June 19, 2015 12:47
Gulp Configurable Tasks
{
"theme": "default",
"minifyCss": true,
"uglifyJS": true,
"bless" : {
"useImport": false
},
"bootstrap": {
"js": [
"bower_components/bootstrap/js/transition.js",
@toh82
toh82 / SassMeister-input-HTML.haml
Last active January 8, 2016 08:26
Bootstrap Grid with SCSS Susy and Breakpoint
%div.grid__container
%div.grid__row
%div.grid__col.grid__col--xs-2
foo
%div.grid__col.grid__col--xs-2
foo
%div.grid__col.grid__col--xs-4
foo
%div.grid__col.grid__col--xs-2
foo
@toh82
toh82 / moduleLauncher.js
Last active August 29, 2015 14:25
JS Module Launcher
(function ($) {
var moduleLauncher = {
oSettings: {
prefix: 'js_',
moduleRegister: [],
debug: false
},
/**
* Method to print out debug information
@toh82
toh82 / data-script.php
Last active August 29, 2015 14:26
Install Script for Magento static blocks
<?php
/** @var Mage_Cms_Model_Block $oLoadedCmsBlock */
$oCmsBlockModel = Mage::getModel('cms/block')->setStoreId($aBlockData['stores'])->load($aBlockData['identifier']);
$bDoesStoreMatchCurrentBlockStore = $aBlockData['stores'] === (int)$oCmsBlockModel->getStoreId()[0];
if($oCmsBlockModel->getId() && $bDoesStoreMatchCurrentBlockStore) {
// update block
$oCmsBlockModel->setContent($aBlockData['content']);
} else {
// save new block
@toh82
toh82 / update_cms_page.php
Created July 30, 2015 08:55
Updating Magento CMS Pages
/** @var Mage_Cms_Model_Page $oMagePageModel */
$oMagePageModel = Mage::getModel('cms/page');
foreach ($aHomePageTeaserContent as $iStoreId => $sHomePageTeaserContent) {
$iPageId = $oMagePageModel->checkIdentifier('home', $iStoreId);
$oPage = $oMagePageModel->load($iPageId);
$sPagePrevContent = $oPage->getContent();
$oPage->setData('stores', array($iStoreId));
@toh82
toh82 / setup.js
Last active August 29, 2015 14:26
Extend Magento RTE with HTML 5 Tags
(function (getSettings) {
/**
* change standard behavior to not wrap code into <p>-tag
* and add some html5 tags
*
* @param mMode
* @returns {object}
*/
tinyMceWysiwygSetup.prototype.getSettings = function (mMode) {
var oSettings = getSettings.call(this, mMode);
@toh82
toh82 / InstallHelper.php
Last active August 29, 2015 14:26
Magento EE Customer Attributes Install-script
<?php
class Project_Customer_Helper_Install extends Mage_Core_Helper_Abstract
{
/**
* @param string $sEntityIdentifier
* @param string $sAttributeIdentifier
* @param string $sSortOrder
* @throws Mage_Core_Exception
*/

How to deal with styles in Magento 2
We all know, Magento 2 introduced a new framework for frontend styling with less and grunt.
All the shiny new technologies, we learned to love for our frontend development in Magento 1
and it has a built-in compiling process, too — doesn’t this sound stellar?
In this talk we'll investigate why it could be good or why bad, to learn this new Magento 2 framework,
instead of trying to bend the system to the process we're comfortable with.

After 10 years of handcrafting web design and frontend coding, I started heavily working with javascript, css preprocessors and Magento about 4 years ago. Starting as a junior frontend developer at a big company, I made my way through smaller design agencies as a technical project lead, frontend concept engineer, designer and developer. As a trained designer and mainly self-learned frontend coder, I really enjoy the powers of both worlds and love to combine them to make awesome projects. Nowadays I work as a frontend lead developer for e-commerce projects at Sitewards. I love contributing to open source projects and community work in general because of the huge amount of power which a community can share. My strengths are solving structural issues with HTML and stylesheets, writing ass kicking styles, developing user interfaces in javascript and I’m also good at designing user interfaces for apps and shops.