This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//... | |
/** | |
* Add the Lithium core library. This sets default paths and initializes the autoloader. You | |
* generally should not need to override any settings. | |
*/ | |
Libraries::add('lithium'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace admin\controllers; | |
class IndexController extends \lithium\action\Controller { | |
public function index() { | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Boolean Value | |
console.log('===== Boolean Value!'); | |
console.log( ( 1 ) ? 'true' : 'false' ); // true | |
console.log( ( '0' ) ? 'true' : 'false' ); // true | |
console.log( ( '1' ) ? 'true' : 'false' ); // true | |
console.log( ( [] ) ? 'true' : 'false' ); // true | |
console.log( ( {} ) ? 'true' : 'false' ); // true | |
console.log( ( '' ) ? 'true' : 'false' ); // false | |
console.log( ( 0 ) ? 'true' : 'false' ); // false | |
console.log( ( NaN ) ? 'true' : 'false' ); // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo; | |
var bar = foo || 'Hello World!'; | |
console.log(bar); //return 'Hello World' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Test if a variable is set and not empty | |
*/ | |
//var not defined | |
var_dump(isset($var) && !empty($var)); // return false | |
var_dump(!empty($var)); // return false | |
var_dump($var); // throw a warning | |
var_dump(!$var); // throw a warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FooController extends \lithium\action\Controller { | |
public function _init() { | |
parent::_init(); | |
$userNotConnected = true; | |
if($userNotConnected) { | |
return $this->redirect('logout', array('exit'=>true)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#element').on('keypress', function(e) { | |
if(e.which == 13) { | |
// action(); | |
e.preventDefault(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$('input[name="myInput"]:checked').val(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$('input[name="number"]').bind('keypress', function(e){ | |
var keyCode = (e.which)?e.which:event.keyCode | |
return !(keyCode>31 && (keyCode<48 || keyCode>57)); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scp example.txt username@server:/path/to/upload/ |