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
@mrkodssldrf
mrkodssldrf / theme.php
Created September 23, 2012 08:31
PyroCMS Mytemplate theme.php
<?php
class Theme_Mytemplate extends Theme {
public $name = 'Mein Template';
public $author = 'Mirko Düßeldorf';
public $author_website = 'http://www.derduesseldorf.de';
public $website = 'http://www.derduesseldorf.de';
public $description = 'Mein erstes Template für PyroCMS';
public $version = '1.0';
@mrkodssldrf
mrkodssldrf / default.html
Created September 23, 2012 08:44
PyroCMS Html Default Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{settings:site_name}} &raquo; {{template:title}}</title>
{{template:metadata}}
{{theme:css file="styles.css"}}
</head>
@mrkodssldrf
mrkodssldrf / gist.php
Created September 23, 2012 09:07
Simple Gist Plugin for PyroCMS
<?php
/**
* Gist Plugin
*
* Simple Plugin to fetch a gist from github
*
* usage: {{gist:get id="gistid"}}
*
* @author Mirko Düßeldorf
@mrkodssldrf
mrkodssldrf / video.php
Created September 23, 2012 11:16
PyroCMS Video Plugin
<?php
/**
* Video Plugin
*
* Plugin to fetch Videos from various Sites
*
* youtube: {{video:youtube id="youtubeid"}}
* vimeo: {{video:vimeo id="vimeoid"}}
*
@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:
@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 / Complex.php
Last active December 19, 2015 08:29
Complex-Number calculation
<?php
class Complex {
/**
* Real
* @var double
*/
private $real;
@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 / 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 / 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",