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() 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() | #!/bin/bash | |
| # list of programs we depend on | |
| progs="xdpyinfo grep head sed ffmpeg pacat parec sox" | |
| # check for programs we depend on | |
| result=0 | |
| for prog in $progs | |
| do | |
| type -p $prog > /dev/null |
| // Simulating infinite-length leading lookbehind in JavaScript. Uses XRegExp. | |
| // Captures within lookbehind are not included in match results. Lazy | |
| // repetition in lookbehind may lead to unexpected results. | |
| (function (XRegExp) { | |
| function prepareLb(lb) { | |
| // Allow mode modifier before lookbehind | |
| var parts = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*)\)$/.exec(lb); | |
| return { |
| JSON._dateReviver = function (k,v) { | |
| if (v.length !== 24 || typeof v !== 'string') return v | |
| try {return new Date(v)} | |
| catch(e) {return v} | |
| } | |
| JSON.parseWithDates = function (obj) { | |
| return JSON.parse(obj, JSON._dateReviver); | |
| } |
| var foo = require('./foo') | |
| , barOfFoo = moduleOfModule('./bar', './foo') | |
| function moduleOfModule(module, ofModule) { | |
| var c = require.cache[require.resolve(ofModule)] | |
| , f = require.resolve(module, c) | |
| , r | |
| c.children.some(function(c) { | |
| if(c.filename === f) { | |
| r = c.exports |
| #! /usr/bin/env bash | |
| function nEnabled { | |
| system_profiler -detailLevel mini SPAirPortDataType | grep -e 'Supported PHY Modes: .*n' | |
| } | |
| until nEnabled && sleep 2 && nEnabled; | |
| do | |
| echo 'resetting airport' | |
| networksetup -setairportpower en1 off; networksetup -setairportpower en1 on |