This is a suggestion of how to backup a DB (MySQL/MariaBD), rotate the backups and mirror them from another server
First we need to backup the database on a given frequency
- Create a dedicated directory
<?php | |
namespace App\Security; | |
use Firebase\JWT\JWT; | |
use Firebase\JWT\SignatureInvalidException; | |
use Symfony\Component\Cache\Adapter\AbstractAdapter; | |
use Symfony\Component\Cache\Adapter\ApcuAdapter; |
/** Checks if the JWT is present and not expired | |
The token is expected to be found in `token` environment variable | |
*/ | |
function isValidToken() { | |
const token = pm.environment.get("token"); | |
if (!token) { | |
console.log("Token is missing"); | |
return false; | |
} | |
// Payload is retrieved after JSON parsing the base64 decoded `atob()` 2nd part of the JWT `[1]` |
<?php | |
namespace AdminBundle\Form; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; | |
use Symfony\Component\Security\Core\Role\Role; |
<?php | |
/** | |
* @param string|array $dottedParts | |
* @param string $parent | |
* @return array | |
*/ | |
public function getJoinsFromDottedPath($dottedParts, $parent = 'entity') | |
{ | |
if (!is_array($dottedParts)) { | |
// Assuming the $dottedParts is a string |
- (void)listSubviewsOfView:(UIView *)view { | |
[self listSubviewsOfView:(UIView *)view withPrefix:@""]; | |
} | |
- (void)listSubviewsOfView:(UIView *)view withPrefix:(NSString *)prefix { | |
NSArray *subviews = [view subviews]; | |
for (UIView *subview in subviews) { | |
NSLog(@"%@ %@ (%d %d; %d %d)", prefix, subview.class | |
, (int)subview.frame.origin.x | |
, (int)subview.frame.origin.y | |
, (int)subview.frame.size.width |
from fabric.api import * | |
from fabric.colors import green | |
env.hosts = ['my_user@my_host'] | |
env.password = 'my_password' | |
env.app_path = 'my/app/path' | |
def commit(): | |
print(green("Commit last modifs...")) | |
local('git add -A && git commit') |
/* | |
* CakePHP Twitter Bootstrap Typeahead with id | |
* ProjectsController.php | |
* <?php $this->set('projects', $this->Project->find('list'); $this->render('list', 'ajax'); ?> | |
* /app/View/Projects/list.ctp | |
* <?php echo json_encode($projects); ?> | |
* data = {'id': 'item name', ..}; | |
* /app/View/Tasks/index.ctp | |
* <input type="hidden" id="TaskProjectId" name="data[Task][project_id]"/> | |
* <input autocomplete="off" data-provide="typeahead" class="typeahead" type="search" id="TaskProject"> |