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
import "github.com/eknkc/amber" | |
... | |
//path is the directory containing home.amber and header.amber | |
templates, err := amber.CompileDir(path, amber.DefaultDirOptions, amber.DefaultOptions) | |
//error handling | |
... | |
type temp struct { | |
Name string |
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
mixin row(c1, c2, c3, c4) | |
tr | |
td= c1 | |
td= c2 | |
td= c3 | |
td= c4 |
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
tbody | |
each val, index in data | |
+row(val['c1'], val['c2'], val['c3'], val['c4']) |
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
tbody | |
each val, index in data | |
+row(val['c1'], val['c2'], val['c3'], val['c4']) |
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 | |
function getContent() | |
{ | |
$pug = new \Pug\Pug([ | |
'basedir' => __DIR__ . '/templates', | |
]); | |
return $pug->renderFile('mail.pug', [ | |
'name' => "Example User", | |
'data' => [ | |
['c1' => 'v11', 'c2' => 'v12', 'c3' => 'v13', 'c4' => 'v14'], |
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 | |
//Client.php | |
function __construct() { | |
# create our client object | |
$this->mClient = new \GearmanClient(); | |
# add the default server (localhost) | |
$this->mClient->addServer(); | |
} |
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 | |
public function run(string $user) { | |
$this->mClient->doBackground(self::JOB_TYPE_REPORT, $user); | |
if ($this->mClient->returnCode() != GEARMAN_SUCCESS) { | |
throw new \Exception("Fatal Error"); | |
} | |
} |
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 | |
function __construct() { | |
# Create our worker object. | |
$this->mWorker = new \GearmanWorker(); | |
# Add default server (localhost). | |
$this->mWorker->addServer(); | |
$this->mWorker->addFunction(Client::JOB_TYPE_REPORT, [$this, "report"]); | |
} |
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 | |
public function run() { | |
while ($this->mWorker->work()) { | |
if ($this->mWorker->returnCode() != GEARMAN_SUCCESS) { | |
throw new \Exception("Fatal Error"); | |
} | |
} | |
} | |
public function report(\GearmanJob $job) { | |
//simulate long running task |
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
paths: | |
migrations: %%PHINX_CONFIG_DIR%%/db/migrations | |
seeds: %%PHINX_CONFIG_DIR%%/db/seeds | |
environments: | |
default_migration_table: phinxlog | |
default_database: development | |
production: | |
adapter: mysql | |
host: localhost |
OlderNewer