Skip to content

Instantly share code, notes, and snippets.

View settermjd's full-sized avatar

Matthew Setter settermjd

View GitHub Profile
@settermjd
settermjd / Powerful, Flexible, Maintainable SQL Generation - Without The Hassle.md
Last active August 29, 2015 14:22
Powerful, Flexible, Maintainable SQL Generation - Without The Hassle

PHP is almost synonymous with databases, and has been since the early versions. Yet creating SQL queries can still be a challenging task. What's the right tool to use? ORMs often feel like overkill. And creating queries by hand can be unmaintainable. In this session, I'll show you how to use the Zend\Db library to generate SQL queries; from simple selects, through to more complex unions, filtered deletions, and updates. You'll learn how to use the library to create flexible, secure, maintainable, and reusable queries quickly, and efficiently, saving you time and effort in the long term.

@settermjd
settermjd / Want a Stellar Project? You Need to Document and Promote It.md
Last active August 29, 2015 14:22
Want a Stellar Project? You Need to Document and Promote It

Do you have an awesome WordPress plugin, Drupal module, Zend Framework module, or PHP library, one that you want people to use, to be truly successful, perhaps one people even rave about? Often, most of the effort expended on a project goes in to development, with documentation and promotion considered after-thoughts. But these two steps are essential to a project's success. In this session, I'll show you key ways to document and promote your project, so it's easier to find out about, to start using, to maintain, and to grow its reputation, using examples of real world successes.

@settermjd
settermjd / Building a Virtual Business.md
Last active August 29, 2015 14:22
Building a Virtual Business

Ever dreamed of being your own boss? We often think that building a business involves a lot of money and time (and it does). There are also innumerable software applications to handle countless day-to-day processes; whether that's accounting, project management, time tracking, and so on.

In reality however, its not that difficult to spin up infrastructure to support routine business tasks. Whether you're starting out as a freelancer, or building a fully-fledged business, replete with employees and payroll, there are services and apps to help.

In this session, I'll show you the key applications you need to start and build a successful business, on a virtual shoestring. Along the way, I'll share what I've learned building my own programming and writing business, when it comes to working with clients, getting paid, and managing projects and tasks.

@settermjd
settermjd / README.md
Last active August 29, 2015 14:21 — forked from Ocramius/README.md
<?php
/**
* This class allows the Controller to be instantiated as a factory by the ServiceManager
*/
namespace BabyMonitor\Controller\Factories;
use Zend\ServiceManager\FactoryInterface,
Zend\ServiceManager\ServiceLocatorInterface,
Monitor\Controller\MonitorController;
@settermjd
settermjd / group-by-in-zend-db.php
Last active August 29, 2015 14:18
Joining equal values​​, that were returned from a database
/**
* The following code builds this query:
* SELECT `amount`
* , GROUP_CONCAT(`Name` SEPARATOR ', ') AS `name`
* FROM `table`
* GROUP BY `amount`
* ORDER BY `amount` DESC
* LIMIT 0, 3
*/
public function getSome()
@settermjd
settermjd / query-with-winston.sh
Created March 31, 2015 14:44
Querying with Winston
node winston.query.js | tr "[{:,'" ' ' | tr -s " " | awk '/country/ { print $2 }' | sort | uniq | wc -l | tr -s " "
@settermjd
settermjd / spark-service
Created March 2, 2015 10:40
A simple chkconfig script to manage starting and stopping the Maven/Jetty server, which supports a SparkJava application
#! /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.
#
@settermjd
settermjd / gist:b9f4c875c252c587e737
Created February 26, 2015 12:15
Attempting to know if the following examples are effectively the same thing
/**
* 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");
}
// 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',