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
<?xml version="1.0" encoding="UTF-8" ?> | |
<project name="Awesome Application" default="update"> | |
<target name="update" description=""> | |
<property name="username" value="" /> | |
<property name="hostname" value="" /> | |
<property name="public_path" value="/srv/www/your-app/public_html" /> | |
<exec outputProperty="result" | |
command="ssh ${username}@${hostname} 'cd ${public_path}; git pull;'" /> |
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 implode_filter($glue , $pieces) { | |
return implode($glue, array_filter($pieces)); | |
} |
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
$oldFormat = array( | |
'male' => 'Male', | |
'female' => 'Female' | |
); | |
$newFormat = array_map(function($value, $label) { | |
return array( | |
'label' => $label, | |
'value' => $value, | |
); |
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
$oDateNow = new DateTime(); | |
$oDateBirth = new DateTime($sDateBirth); | |
$age = $oDateNow->diff($oDateBirth)->y; | |
// its take day into consideration |
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
array_map('unserialize', array_unique(array_map('serialize', $input))); |
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
return array_map(function ($c, $serializedTicket) { | |
$ticket = unserialize($serializedTicket); | |
return [ | |
'id' => $ticket->get('id'), | |
'name' => $ticket->get('name'), | |
'amt' => $this->toDollarFormat($ticket->get('price')->toCent()), | |
'qty' => $c | |
]; |
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
#!/bin/bash | |
# Shell script to backup MySql database | |
# CONFIG - Only edit the below lines to setup the script | |
# =============================== | |
MyUSER="root" # USERNAME | |
MyPASS="password" # PASSWORD | |
MyHOST="localhost" # Hostname |
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 | |
class KeyGenerator | |
{ | |
public static function fromLabels(array $labels) | |
{ | |
if (empty($labels)) { | |
return []; | |
} |
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 App\Controller; | |
use Cake\Event\Event; | |
use Cake\ORM\TableRegistry; | |
use Cake\Utility\Hash; | |
class RegistrationController extends AppController | |
{ |
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
<?= $this->Form->create($entry); ?> | |
<?= | |
$this->Form->input('emy_contact_no.code', [ | |
'options' => ['1' => 1, '2' => 2], | |
'empty' => 'Select', | |
'class' => 'form-control', | |
'label' => false, | |
]) | |
?> |
OlderNewer