Skip to content

Instantly share code, notes, and snippets.

View sandrojenny's full-sized avatar

Sandro Jenny sandrojenny

View GitHub Profile
.clearfix::after {
content: "";
clear: both;
display: block;
visibility: hidden;
}
$colorRed: red;
#header {
margin: 0;
border: 1px solid $colorRed;
p {
color: $colorRed;
font: {
size: 12px;
weight: bold;
module.exports = function(grunt){
grunt.initConfig({
fileCheck: {
src: 'target.txt',
text: 'Test'
}
});
grunt.registerTask('checkFile', function(){
<?php include __DIR__ . "/../layout/header.php"; ?>
<h1>Blog</h1>
<ul>
<?php foreach ($posts as $post): ?>
<li>
<a href="post.php?id=<?php echo $post['id']; ?>">
<?php echo $post['title']; ?>
</a>
// Class PostController
namespace App\Post;
use App\Core\AbstractController;
class PostController extends AbstractController
{
public function __construct(PostsRepository $postsRepository){
// Class Container
namespace App\Core;
use PDO;
use PDOException;
use App\Post\PostController;
use App\Post\PostsRepository;
// Class PostRepository
namespace App\Post;
use App\Core\AbstractRepository;
class PostsRepository extends AbstractRepository {
public function getTableName(){
return "posts";
}
// PostModel Class
namespace App\Post;
use App\Core\AbstractModel;
class PostModel extends AbstractModel {
public $id;
public $title;
public $content;
}
<?php
include("../init.php");
$pathInfo = $_SERVER['PATH_INFO'];
$routes = [
'/index' => [
'controller' => 'postController',
'method' => 'index'
],
function autoload($className){
$prefix = "app";
$dir = "classes";
$clss = substr($className, strlen($prefix));
$clss = str_replace("\\", "/", $clss);
if (file_exists("{$dir}{$clss}.php")) {
require_once("{$dir}{$clss}.php");