Skip to content

Instantly share code, notes, and snippets.

View mrkodssldrf's full-sized avatar

Mirko Düßeldorf mrkodssldrf

  • mrkodssldrf
  • Cologne, Germany
View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-pages/core-pages.html">
@mrkodssldrf
mrkodssldrf / default.phtml
Created June 24, 2014 09:28
Add Product Attributes to Magento Order Email
// File <yourtemplate>/email/order/items/order/default.phtml //
.......
<?php /** Get product attributes */ ?>
<?php $_product = Mage::getModel('catalog/product')->load($_item->getProduct()->getId()) ?>
<?php $_attributes = $_product->getAttributes() ?>
<?php $_arrDisplayAttributes = array('of_attributes_display') ?>
<?php foreach($_attributes as $_attribute) : ?>
<?php $_attributeCode = $_attribute->getAttributeCode() ?>
@mrkodssldrf
mrkodssldrf / gist:891d934d10de2492344c
Created May 28, 2014 07:11
Vertical align elements without fixed height
---CSS
/* Helper to vertical align content*/
.vhelper { height: 100%; padding: 0;}
/* Vertical-Alignment without given height */
.vhelper, .justify-middle { display: inline-block; vertical-align: middle; }
---HTML
@mrkodssldrf
mrkodssldrf / sha1
Created January 22, 2014 14:26
SlimFramework fast sha1 string hash
$app->get('/encrypt/:string', function ($string) use ($app) {
echo sha1($string);
}
);
@mrkodssldrf
mrkodssldrf / userauth
Created January 22, 2014 13:43
Restful User Authentication
...
require 'Slim/Slim.php';
require 'NotORM.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$pdoDatabase = new PDO(
"mysql:dbname=szwebapp;host=localhost",
@mrkodssldrf
mrkodssldrf / calculate percentage
Created January 21, 2014 10:40
Workaround for ExtJS / Sencha Touch 2 to calculate Percentage instead of using css3
// Normally you would calculate with css3
style="width: calc((value/amount) * 100%);"
// With ExtJS - in order to build a native app - you have to use this workaround
style="width: {[(values.value/values.amount) * 100]}%;"
@mrkodssldrf
mrkodssldrf / DatareaderToList
Created October 17, 2013 12:25
Convert SQL Datareader to List<T> C#
public List<T> Query<T>(string query) where T:new()
{
List<T> res = new List<T>();
MySqlCommand q = new MySqlCommand(query, this.db);
MySqlDataReader r = q.ExecuteReader();
while (r.Read())
{
T t = new T();
for (int inc = 0; inc < r.FieldCount; inc++)
@mrkodssldrf
mrkodssldrf / Complex.php
Last active December 19, 2015 08:29
Complex-Number calculation
<?php
class Complex {
/**
* Real
* @var double
*/
private $real;
@mrkodssldrf
mrkodssldrf / sitemap.php
Created September 26, 2012 08:19
Update PyroCMS Core Sitemap to generate a Sitemap
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Sitemap module public controller
*
* Renders a human-readable sitemap with all public pages and blog categories
* Also renders a machine-readable sitemap for search engines
*
* @author Barnabas Kendall <barnabas@bkendall.biz>
* @license Apache License v2.0
* @version 1.1
@mrkodssldrf
mrkodssldrf / image.php
Created September 25, 2012 09:07
Fetch a themeimage by urlsegment for PyroCMS
<?php
/**
*
* Plugin to fetch a themeimage by urlsegment
*
* usage: {{image:get by="url" default="default" img-type="png"}}
*
* Attributes: