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
/** | |
* First construct the Select object for the SQL query to run | |
*/ | |
$select = new Select('tblusers'); | |
$select->columns(array( | |
"recordCount" => new \Zend\Db\Sql\Expression("COUNT(*)") | |
)); | |
/** | |
* Then execute the query, retrieving the first record, if available |
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 MyApplication\Form; | |
use Zend\Form\Annotation; | |
/** | |
* @Annotation\Name("user") | |
* @Annotation\Hydrator("Zend\Stdlib\Hydrator\ObjectProperty") | |
*/ |
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( | |
'router' => array( | |
'routes' => array( | |
'forecaster' => array( | |
'type' => 'Literal', | |
'options' => array( | |
'route' => '/forecaster', | |
'defaults' => array( | |
'__NAMESPACE__' => 'Forecaster\Controller', | |
'controller' => 'Forecaster', |
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
// IndexControllerFactory.php | |
namespace YourModule\Controller\Factory; | |
use Zend\ServiceManager\FactoryInterface, | |
Zend\ServiceManager\ServiceLocatorInterface, | |
Zend\ServiceManager\Exception\ServiceNotCreatedException, | |
YourModule\Controller\IndexController; | |
class IndexControllerFactory implements FactoryInterface | |
{ |
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 | |
/** | |
* Define the custom form element | |
*/ | |
namespace Forecaster\Form\Element; | |
use Zend\Form\Element\Select; | |
use Zend\InputFilter\InputProviderInterface; | |
use Zend\Validator\Db\RecordExists; | |
use Zend\ServiceManager\ServiceLocatorAwareInterface; |
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
server { | |
listen 80; | |
server_name owncloud.app | |
return 301 https://$server_name$request_uri; # enforce https | |
} | |
server { | |
listen 443 ssl; | |
server_name owncloud.app; | |
root /home/vagrant/owncloud; |
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
// The following is a route to simplify getting started creating | |
// new controllers and actions without needing to create a new | |
// module. Simply drop new controllers in, and you can access them | |
// using the path /application/:controller/:action | |
'application' => array( | |
'type' => 'Literal', | |
'options' => array( | |
'route' => '/application', | |
'defaults' => array( | |
'__NAMESPACE__' => 'Application\Controller', |
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
/** | |
* Are these two examples the same, with the second just being more verbose? | |
*/ | |
import static spark.Spark.*; | |
public class HelloWorld { | |
public static void main(String[] args) { | |
get("/hello", (req, res) -> "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
#! /bin/bash | |
# | |
# spark-service Start/Stop the Maven Jetty process | |
# | |
# chkconfig: 235 90 60 | |
# description: This will manage the starting and stopping of the Maven/Jetty | |
# server which will render the SparkJava application. It's | |
# rather simple, so don't expect miracles of it. | |
# |
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
node winston.query.js | tr "[{:,'" ' ' | tr -s " " | awk '/country/ { print $2 }' | sort | uniq | wc -l | tr -s " " |