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 | |
// Stupid dirty example of how to load only the routes you want. | |
$app->hook('slim.before.router', function() use ($app) { | |
$uri = $app->request()->getResourceUri(); | |
$params = explode('/', substr($uri, 1, strlen($uri))); | |
if (file_exists(APP_ROOT . '/app/routes/' . $params[0] . '.php')) | |
include APP_ROOT . '/app/routes/' . $params[0] . '.php'; | |
}); |
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
I have my model here: | |
// transactionmodel.js | |
function TransactionModel() { | |
var pg = require('pg'); | |
var connectionString = "pg://chartjes:******@localhost:5432/ibl_stats"; | |
this.client = new pg.Client(connectionString); | |
this.client.connect(); | |
this.getCurrent = function() { |
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 AncientFileFilter extends \FilterIterator { | |
protected $DaysOld = 7; | |
public function __construct($dir,$days=null) { | |
// is the specified directory valid? | |
if(!is_string($dir) || !is_dir($dir) || !is_readable($dir)) |
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 AncientFileFilter extends \FilterIterator { | |
protected $DaysOld = 7; | |
public function __construct($dir,$days=null) { | |
// is the specified directory valid? | |
if(!is_string($dir) || !is_dir($dir) || !is_readable($dir)) |
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
var fs = require('fs'); | |
var stream = fs.createReadStream('./test/fixtures/current'); | |
var currentData = ''; | |
stream.on('error', function (err) { | |
throw err; | |
}); | |
stream.on('data', function (data) { | |
currentData += data; | |
}); |
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 | |
$content = '<div class="actions"> | |
<a href="http://davidwalsh.name/demo/folding-animation.php" class="demo">Some text<i class="something"></i></a> | |
<a href="http://davidwalsh.name/demo/folding-animation.php" class="demo">Some other text</a> | |
<div class="clear"></div> | |
</div>'; | |
$results = preg_replace('/(<a\s+.*?class="demo".*?)((?<!<\/i>)<\/a>)/i', '${1}<i class="something"></i></a>', $content); |
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 | |
$obj1 = new StdClass; | |
$obj2 = new StdClass; | |
$obj3 = new StdClass; | |
$obj1->name = "Joe"; | |
$obj2->name = "Jane"; | |
$obj3->name = "Johnny"; |
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
Writing maintainable software is something we all strive to do when we start a project. | |
The problem is, there is no simple checklist that states whether your code is maintainable or not. | |
I once read it is much easier to recognize the absence of maintainable software than to define it. | |
In this session we will lay out a foundation to building more maintainable software and practices | |
to better your team workflow. We will cover anything from naming of methods/variables, VCS commit | |
messages, and code reviews. |
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
APIs are becoming the preferred data source for applications everywhere. Whether your API | |
is being consumed by JavaScript frontend, mobile app, or a microservice; you need | |
a solid foundation. With a plethora of information to sort through you can become | |
overwhelmed with questions: "Is this RESTful enough?" and "What the hell is HATEOAS, and | |
why should I care?" This talk will bring focus to the core building blocks of an API, | |
including: URI structure, response codes, pagination, documentation, authentication, and much more. |
OlderNewer