Skip to content

Instantly share code, notes, and snippets.

View lloc's full-sized avatar
🏠
Working from home

Dennis Ploetner lloc

🏠
Working from home
View GitHub Profile
window.onload = function () {
console.log("Merry Christmas");
};
@lloc
lloc / my_msls_blog_collection_get.php
Last active March 14, 2021 07:01
Multisite Language Switcher: Howto use the "msls_blog_collection_get"-filter
<?php
function my_msls_blog_collection_get( $objects ) {
$objects = array();
$blogs = array( 1 => 'Override English', 2 => 'Override Deutsch', );
foreach ( $blogs as $id => $description ) {
$details = get_blog_details( $id );
if ( is_object( $details ) ) {
$objects[$id] = new MslsBlog( $details, $description );
}
@lloc
lloc / gist:6650222
Created September 21, 2013 12:37
Install WordPress Coding Standards for PHP_CodeSniffer in Ubuntu
# Install PHP_CodeSniffer
sudo apt-get install php-codesniffer
# Install the WordPress Coding Standards
sudo git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git \
$(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress
# Now your can check your files like this
phpcs --standard=WordPress your-file.php
@lloc
lloc / hooks.md
Last active July 3, 2019 04:43
Hooks, filters and actions
<?php
/**
* Class BoundingBox
*/
class BoundingBox {
/**
* @var float $lat
* @var float $lon
@lloc
lloc / proxy.py
Last active April 26, 2019 10:00
Configure GitHub for a connection trough a proxy with a pacfile
#!/usr/bin/env python
"""
The config.ini contains something like:
[Proxy]
proxy = http://YOURPROXY/proxy.pac
user = YOURUSER
pass = YOURPASS
local = proxy.pac
<?php
/*
Plugin Name: WordPress serves JSON
Description: Serve your content as JSON or JSONP in a simple manner (based on an example by Jon Cave - http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/).
Plugin URI: https://gist.github.com/lloc/8933914
Author: realloc
Author URI: http://lloc.de/
*/
namespace LLOC\realloc;
<?php
namespace wctrn\realloc;
abstract class Option {
abstract function get( int $id );
}
<?php
namespace wctrn\realloc;
interface Thing {
public function the_content( string $content ) : void;
}
class Tag implements Thing {
<?php
function variadic_sum( int ... $args ) {
return array_sum( $args );
}
// echoes 6
echo variadic_sum( 1, 2, 3 ), PHP_EOL;
$a = [ 1, 2, 3 ];