Skip to content

Instantly share code, notes, and snippets.

Automatisches Erstellen von Sitemaps unter UNIX:

wget --mirror --no-parent --reject jpg,jpeg,png,gif,svg,mp3,mp4,JPG,pdf,PDF,woff,eof,eot,ttf --output-file=ran-wget.log http://www.ondigo.de/ 

tree | grep -v index.html

@thomaspuppe
thomaspuppe / formatDateObject.js
Created September 25, 2014 14:21
Format a JS Date Object according toa given String
/* *****************************************************************************
* Formates a JS Date Object according toa given String. The Place holders
* work like the php date() function, but not every case is implemented !
*
* %d% Day of the month, 2 digits with leading zeros
* %j% Day of the month without leading zeros
* %m% Numeric representation of a month, with leading zeros
* %n% Numeric representation of a month, without leading zeros
* %Y% A full numeric representation of a year, 4 digits
* %y% A two digit representation of a year
@thomaspuppe
thomaspuppe / .bashrc
Last active August 29, 2015 14:06
bash config file
# NOTE: This shit is mixed up (Ubuntu Linux vs Mac OS)
# ######################################
# Functions and Parameters for Own Aliases
# ######################################
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@thomaspuppe
thomaspuppe / url-parser.js
Created October 24, 2013 12:51
Native JS URL Zerpflückung
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@thomaspuppe
thomaspuppe / gist:5378650
Last active February 3, 2016 12:38
git Commands

##Fetch the status from origin and ignore all local changes

git fetch --all
git reset --hard origin/master

##Change the last commit Message

git commit --amend -m "New commit message"
@thomaspuppe
thomaspuppe / gist:4593700
Last active December 11, 2015 11:28
Extract Month and Year from a datetime/timestamp coloumn
### With timestamp/integer coloumn (1354711936)
SELECT
FROM_UNIXTIME(crdate, '%Y') AS year,
FROM_UNIXTIME(crdate, '%M') AS month,
COUNT(uid) AS number
FROM `tx_campeforms_domain_model_contact`
WHERE interest LIKE "%Techniker%"
AND email NOT LIKE "%test.de%"
AND email NOT LIKE "%ondigo.de%"
@thomaspuppe
thomaspuppe / Bugs
Last active December 11, 2015 06:08
Dumme Fehler. Bitte nur einmal machen.
Cache! In allen Ebenen, samt Inhalt und Header.
=================================================
MySQL Tabellen anlegen: TYPE=InnoDB => ENGINE=InnoDB
=================================================
SITUATION: Formular. Eine Zeile soll via JS ausgeblendet werden, wenn das Feld nicht benötigt wird. Suche per parents('.selector').
FEHLER: Nachdem sich die HTML-Struktur änderte, gab es weiter oben im DOM weitere '.selector' , sodass plötzlich praktisch die ganze Seite ausgeblendet wurde.
@thomaspuppe
thomaspuppe / .htaccess
Created January 4, 2013 16:45
Redirect of a certain path in .htaccess
# Redirect auf Sitemap (extern, Weiterleitung)
RewriteRule sitemap.xml$ /index.php?eID=dd_googlesitemap [L,Redirect=permanent]
# Redirect auf Sitemap (intern, Auslieferung)
RewriteRule ^sitemap\.xml$ index.php?eID=dd_googlesitemap [L]
@thomaspuppe
thomaspuppe / php.ini
Created December 19, 2012 11:40
Error Logging bei Mittwald-Projekten
# /etc/php/php.ini
log_errors = On
error_log = /tmp/php-error.log
@thomaspuppe
thomaspuppe / .htaccess
Created November 6, 2012 11:25
.htaccess Redirect for folders, preserving subfolders
### Redirect for folders, preserving subfolders
RedirectMatch 301 ^/en/orchester/mitglieder/musiker/(.*) /en/orchestra/musician/$1
RedirectMatch 301 ^/orchester/mitglieder/musiker/(.*) /orchester/musiker/$1