Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig()
method and call initStateMachine()
method at initialization (__contruct()
method).
Example
$items = array(); | |
foreach($_POST['PO_LineItems'] as $item) { | |
$model = new PO_LineItem; | |
$model->setAttributes($item); | |
} | |
$poModel->LineItems = $items; | |
if($poModel->withRelated(true,array('LineItems'))) { | |
// everything is saved and we're ok |
<?php | |
private $_browser; private $_objMobileDetect; | |
public function init() | |
{ | |
... | |
} | |
public setBrowser(Browscap $browser) {}; | |
public function getBrowser() { | |
if(!isset($this->_browser)) { | |
$objBrowserCap = new \phpbrowscap\Browscap($this->cachePath); |
function toDeci(fraction) { | |
var result,wholeNum=0, frac, deci=0; | |
if(fraction.search('/') >=0){ | |
if(fraction.search('-') > 0){ | |
var wholeNum = fraction.split('-'); | |
frac = wholeNum[1]; | |
wholeNum = parseInt(wholeNum,10); | |
}else if(fraction.search(' ') > 0){ | |
var wholeNum = fraction.split(' '); | |
fraction = wholeNum[1]; |
Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig()
method and call initStateMachine()
method at initialization (__contruct()
method).
Example
namespace common\components; | |
use \yii\web\UrlManager as BaseUrlManager; | |
class UrlManager extends BaseUrlManager { | |
protected $choice; | |
public function init() { | |
Component::init(); |
<?php | |
/* Note that the class and methods are prototype code, not copy/paste code | |
* | |
* However, the actual code in the action has been tested with a Yii2 app | |
* | |
*/ | |
class QueueComponent extends Component { | |
public function actionTest() { | |
$sync = new \Illuminate\Queue\SyncQueue; |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
creativeFields: [ | |
{name: 'Yehuda'}, | |
{name: 'Tom' }, | |
{name: 'Trek' } | |
] |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
Restricted SFTP-only access to a single directory using OpenSSH 4.9+ | |
Edit ```/etc/ssh/sshd_config``` | |
``` | |
Match Group sftp-users | |
# Force the connection to use SFTP and chroot to the required directory. | |
ForceCommand internal-sftp | |
ChrootDirectory /home/sftp-users | |
# Disable tunneling, authentication agent, TCP and X11 forwarding. |