Skip to content

Instantly share code, notes, and snippets.

View marcogrueter's full-sized avatar

Marco Grüter marcogrueter

  • CH - Steinhausen
View GitHub Profile
@marcogrueter
marcogrueter / php_jquery_cycle.php
Created August 21, 2012 11:54
php output for jquery cycle
<?php
//funktions aufruf
bilder_ausgeben('./uploads/default/files/');
function bilder_ausgeben($ordner)
{
$erlaubte_bilder = array('gif', 'jpeg', 'png', 'jpg');
if( ! is_dir($ordner) )
@marcogrueter
marcogrueter / gist:3480605
Created August 26, 2012 14:48
includes stuff
/* tour1.php
<?php
$titel = 'Tour 1';
?>
include('pfad/zum/header.php');
/* dein seiten content /*
include('pfad/zum/footer.php');
@marcogrueter
marcogrueter / gist:3481111
Created August 26, 2012 15:26
email template
<?php
// alle variablen durch die CHECK funktion schmeissen
$name = check_input($_POST['name'], "Namen eingeben!");
$email = check_input($_POST['email'], "Email Adresse eingeben!");
$str = check_input($_POST['str'], "Strasse eingeben!");
$plz = check_input($_POST['plz'], "PLZ eingeben!");
$textfeld = check_input($_POST['textfeld'],"Text eingeben!");
@marcogrueter
marcogrueter / gist:3481207
Created August 26, 2012 15:41
slt htaccess
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache config if possible
# httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@marcogrueter
marcogrueter / gist:3481354
Created August 26, 2012 16:08
kontakt verarbeitung
/* kontakt.php */
<?php
if(isset($_SESSION['status']) && $_SESSION['status'] == 'kontakt_erfolgreich')
{
echo '<p> Ihre Nachricht wurde erfolgreich &uuml;bermittelt. Wir werden sie so schnell wie möglich kontaktieren. </p>';
unset($_SESSION['status']);
}
?>
/* kontakt verarbeiten */
<ul>
{{ navigation:links group="header" }}
<li><a href="{{ url }}">{{ title }}</a>
{{ if children_level_1 }}
<ul>
{{ children_level_1 }}
<li><a href="{{ url }}">{{ title }}</a>
{{ if children_level_2 }}
<ul>
{{ children_level_2 }}
@marcogrueter
marcogrueter / excel briefanrede
Created June 27, 2013 11:58
excel formel um briefanrede aus Anrede, akad. Titel und Nachname zu bilden
deutsch:
=VERKETTEN(WENN(A2="Herr","Sehr geehrter Herr ","Sehr geehrte Frau "),WENN(UND(ISTTEXT(B2),ISTZAHL(SUCHEN("Prof",B2))),"Professor ",WENN(UND(ISTTEXT(B2),ISTZAHL(SUCHEN("Dr",B2))),"Doktor ","")),E2)
französisch:
=VERKETTEN(WENN(UND(ISTTEXT(B2),ISTZAHL(SUCHEN("Prof",B2))),"Professeur,",WENN(UND(ISTTEXT(B2),ISTZAHL(SUCHEN("Dr",B2))),"Docteur,",A2)))
<?php
class Plugin_registration {
public function is_open()
{
$limit = $this->attribute('limit', 150);
return ! ($limit >= $this->db->count_all('your_stream_table'));
}
}
@marcogrueter
marcogrueter / emafo_dnd
Created July 31, 2013 14:11
e-mafo drag'n'drop snippet
$(function() {
// init the draggables
// the revert thing makes them go back to the original position if they weren't accepted by the droppable
$(".draggable").draggable({
revert : function(event, ui) { $(this).data("uiDraggable").originalPosition = { top : 0, left : 0 }; return !event; }
});
// init the droppables
$(".droppable").droppable({
@marcogrueter
marcogrueter / sort-array
Created September 17, 2013 15:16
sort any array in php with strnatcasecmp
// just make sure the $sort_by key exists in $data
public function sort_entries(&$data, $sort_by = false)
{
if( ! $sort_by )
{
$sort_by = 'sort';
}
usort($data, function($a, $b) use($sort_by) {
return strnatcasecmp($a[$sort_by], $b[$sort_by]);