Skip to content

Instantly share code, notes, and snippets.

View schuhwerk's full-sized avatar

Vitus Schuhwerk schuhwerk

View GitHub Profile
@schuhwerk
schuhwerk / flatpickr php date.js
Created February 28, 2018 12:21
Use a variable PHP datestring to format a date in Javascript
/**
* Localize a Datepicker / Timepicker (flatpickr)
* Format PHP datestring to js and vice versa
*
* fromPhp is the variable that gets passed via wordpress wp_localize_script
* fromPhp.dateFormat get_option( 'date_format' );
* fromPhp.timeFormat get_option( 'time_format' );
*/
//https://github.com/kartik-v/php-date-formatter
Platzhalter in {} sind zu ersetzen!
Externer Link über die Schaltfläche des ILIAS-Editors. Link öffnet sich in neuem Fenster/Tab, je
nach Browser-Einstellung des Users:
[xln url="{URL des Space}"]{anzuzeigender Text}[/xln]
Beispiel:
[xln url="https://llc.th-koeln.de/ipk/"]Space: Interne Projektkoordination[/xln]
@schuhwerk
schuhwerk / sample-plugin.php
Created October 2, 2017 16:00
A simple sample plugin / template plugin / demo plugin (mostly without Settings API) which creates a * Settings page in a Wordpress Network (WPMU).
<?php
/**
* Plugin Name: My Plugin
* Plugin URI:
* Description: A simple sample plugin / template plugin / demo plugin (mostly without Settings API) which creates a
* Settings page in a Wordpress Network (WPMU).
* Replace 'my_plugin' and 'my-plugin' with something that makes sense to you and you are set
* Regex: replace my(.)plugin with really$1nice
* Add some settings to default_settings (use underscores for values) and add descriptions in $this->decriptions
* If you want a custion form-field: your_setting_form_callback($name, $value, $description)
@schuhwerk
schuhwerk / image-list.txt
Created March 28, 2017 15:06
A list of images from lormpixel
http://lorempixel.com/400/200/abstract/0
http://lorempixel.com/400/200/abstract/1
http://lorempixel.com/400/200/abstract/2
http://lorempixel.com/400/200/abstract/3
http://lorempixel.com/400/200/abstract/4
http://lorempixel.com/400/200/abstract/5
http://lorempixel.com/400/200/abstract/6
http://lorempixel.com/400/200/abstract/7
http://lorempixel.com/400/200/abstract/8
http://lorempixel.com/400/200/abstract/9
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>KISD - offline</title>
<meta name="description" content="KISD - Maintainance">
<link href="https://fonts.googleapis.com/css?family=Open+Sans|Roboto:300" rel="stylesheet">
<style type="text/css">
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
<FilesMatch "\.(?:sql|bak)$"><br>
Order allow,deny<br>
Deny from all<br>
</FilesMatch>
<style>body {word-wrap: break-word;line-height: 4px;}</style>
<?php
$myDb = array (
0 => "localhost", //host
1 => "root", //username
2 => "", //pass
3 => "citybike", //dbname
);
$mytable = 'table1';
@schuhwerk
schuhwerk / regGit.php
Last active July 10, 2018 06:59
Add to wordpress theme's functions.php thanks to http://interconnectit.com/3920/embed-all-the-gists/ Usage: Paste a gist link into a blog post or page and it will be embedded eg: https://gist.github.com/2926827 If a gist has multiple files you can select one using a url in the following format: https://gist.github.com/2926827?file=embed-gist.php
wp_embed_register_handler( 'gist', '/https?:\/\/gist\.github\.com(\/[^\/]+)?\/([a-z0-9]+)(\?file=.*)?/i', 'wp_embed_handler_gist' );
function wp_embed_handler_gist( $matches, $attr, $url, $rawattr ) {
$embed = sprintf(
'<script src="https://gist.github.com/%1$s.js%2$s"></script>',
esc_attr($matches[2]),
esc_attr($matches[3])
);