Skip to content

Instantly share code, notes, and snippets.

View teresko's full-sized avatar

Mārtiņš Tereško teresko

View GitHub Profile
@teresko
teresko / gist:2907749
Created June 10, 2012 23:46
cannonical SO comment for mysql_* users
Please, don't use `mysql_*` functions to write new code. They are no longer maintained and the community has begun [deprecation process](http://goo.gl/KJveJ). See the [*red box*](http://goo.gl/GPmFd)? Instead you should learn about [prepared statements](http://goo.gl/vn8zQ) and use either [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli). If you can't decide which, [this article](http://goo.gl/3gqF9) will help you. If you pick PDO, [here is good tutorial](http://goo.gl/vFWnC).
@teresko
teresko / coc.md
Last active February 17, 2016 10:54

FOLLOW THE FUCKING LAW CODE OF CONDUCT Version 1, February 2016

Copyright (C) 2016

Everyone is permitted to copy and distribute verbatim or modified copies of this code of conduct, and changing it is allowed as long as the name is changed.

      FOLLOW THE FUCKING LAW CODE OF CONDUCT

OUTLINE OF EXPECTATIONS FOR ACCEPTABLE BEHAVIOR BY COMMUNITY MEMBERS

<?php
public function addhw() {
$array=array(
'hw_name' => $_POST['hw_name'],
'hw_description' =>$_POST['hw_description'],
'hw_model' => $_POST['hw_model'],
'hw_serialno' => $_POST['hw_serialno'],
'hw_manufacturer_id' => $_POST['manufacturer_id'],
<?php
namespace Application\View;
use Fracture\Presentation\View;
use Fracture\Presentation\Template;
class Profile extends View
{
@teresko
teresko / keybase.md
Created September 2, 2015 16:43
keybase.md

Keybase proof

I hereby claim:

  • I am teresko on github.
  • I am teresko (https://keybase.io/teresko) on keybase.
  • I have a public key whose fingerprint is 5678 6C6E 574C B998 5787 FFD7 995C 977E F9C2 7614

To claim this, I am signing this object:

@teresko
teresko / short
Last active August 29, 2015 14:27 — forked from janisdonis/short
$args = array(
'post_type' => 'products',
'tax_query' => array(),
);
if(get_field('multi_filter') ) {
$temp = array();
while(has_sub_field('multi_filter')){
$_temp = array(
'taxonomy' => get_sub_field('taxonomy'),
<?php
$tempList = [];
foreach( $images as $image ) {
$tempList[] = "<img src='{$image['sizes']['large']}'>";
}
?>
<script id="images2<?php echo get_the_ID(); ?>" type="text/cycle">
<?php echo json_encode($tempList); ?>
</script>

Few notes on the subject

  • the three sets of structures from model layer, that you mention, are not the only ones. Only the most common. In larger application you may find, that you also need repositories and units of work. Also I am not entirely sure whether "collection of domain objects" should be mentioned separately or not.

  • there is very little if at all written about ui layer in proper literature. I have found only few snippets from Fowler and that's about it. And most of the content is aimed towards desktop software.

  • controllers do not really do "perform authentication, dispatch requests, render output". Those could be called: external concerns. Your framework/infrastructure supplies the controller with per-processed user input (as arguments or Request class instance) and then controller decides on how to use this input to alter the model layer's state. That's it. The parts that you mentioned before are stuff done in front controller (which is a different from mvc's controller

Few notes on the subject

  • the three sets of structures from model layer, that you mention, are not the only ones. Only the most common. In larger application you may find, that you also need repositories and units of work. Also I am not entirely sure whether "collection of domain objects" should be mentioned separately or not.

  • there is very little if at all written about ui layer in proper literature. I have found only few snippets from Fowler and that's about it. And most of the content is aimed towards desktop software.

  • controllers do not really do "perform authentication, dispatch requests, render output". Those could be called: external concerns. Your framework/infrastructure supplies the controller with per-processed user input (as arguments or Request class instance) and then controller decides on how to use this input to alter the model layer's state. That's it. The parts that you mentioned before are stuff done in front controller (which is a different from mvc's controller