This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!
We start with common example. Session.
<?php
class SessionStorage {
function __construct() | <?php | |
| // https://gist.github.com/magnetikonline/650e30e485c0f91f2f40 | |
| class DumpHTTPRequestToFile { | |
| public function execute($targetFile) { | |
| $data = sprintf( | |
| "%s %s %s\n\nHTTP headers:\n", | |
| $_SERVER['REQUEST_METHOD'], | |
| $_SERVER['REQUEST_URI'], | |
| $_SERVER['SERVER_PROTOCOL'] |
| app.directive('faFastScroll', ['$parse', function ($parse) { | |
| var Interval = function(min, max) { | |
| this.min = min || 0; | |
| this.max = max || 0; | |
| }; | |
| Interval.prototype.clip = function(min, max) { | |
| if(this.max <= min || this.min >= max) { | |
| this.min = this.max = 0; |
| # http://www.ansibleworks.com/docs/modules.html#digital-ocean | |
| # Create a new Droplet | |
| # Will return the droplet details including the droplet id (used for idempotence) | |
| - name: launch DO droplet | |
| hosts: local | |
| gather_facts: False | |
| tasks: | |
| - name: pwd |
| <?php | |
| /** | |
| * Loop Add to Cart -- with quantity and AJAX | |
| * requires associated JavaScript file qty-add-to-cart.js | |
| * | |
| * @link http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/ | |
| * @link https://gist.github.com/mikejolley/2793710/ | |
| */ | |
| // add this file to folder "woocommerce/loop" inside theme |
| #! /usr/bin/env python | |
| from boto.ses.connection import SESConnection | |
| import os | |
| import sys | |
| import subprocess | |
| import socket | |
| TMPFILE = '/var/run/postgresql/last-wal-archive-error-file.tmp' | |
| if __name__ == '__main__': |
| #! /bin/bash | |
| ### BEGIN INIT INFO | |
| # Provides: redis-server | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: redis-server - Persistent key-value db |
| # source: http://blog.lalf.ru/2012/01/django-traceback-production.html#more | |
| from django.views.debug import technical_500_response | |
| import sys | |
| class UserBasedExceptionMiddleware(object): | |
| def process_exception(self, request, exception): | |
| if request.user.is_superuser: | |
| return technical_500_response(request, *sys.exc_info()) |
| <?php | |
| /* | |
| Plugin Name: WP_Rewrite endpoints demo | |
| Description: A plugin giving example usage of the WP_Rewrite endpoint API | |
| Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ | |
| Author: Jon Cave | |
| Author URI: http://joncave.co.uk/ | |
| */ | |
| function makeplugins_endpoints_add_endpoint() { |
| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |
This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!
We start with common example. Session.
<?php
class SessionStorage {
function __construct()