diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..a954525 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "./web/bower_components" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e722b46 --- /dev/null +++ b/.gitignore @@ -0,0 +1,67 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml + +# Sensitive or high-churn files: +.idea/dataSources.ids +.idea/dataSources.xml +.idea/dataSources.local.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml + +# Gradle: +.idea/gradle.xml +.idea/libraries + +# Mongo Explorer plugin: +.idea/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Composer packages +vendor + +# NPM packages +node_modules + +# Bower packages +bower_components + +# Utilities +composer.phar +phpunit.phar + +# Cache +/cache/ + +# Sensitive +/config/config.yaml + +# Compiled code +/web/js/ +/web/css/ diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..72abef0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4e9e470 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/silex-base.iml b/.idea/silex-base.iml new file mode 100644 index 0000000..7440d03 --- /dev/null +++ b/.idea/silex-base.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..af12148 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Saul Johnson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e69de29..294b848 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,56 @@ +# Silex Base Template +Basic Silex project for a simple website. + +I'm presenting here a clean (-ish) starting point for a website written in PHP on Silex. This is a direct port of [my Django base project](https://github.com/lambdacasserole/django-base/). + +![Screenshot](screenshot_small.png) + +## Prerequisites +You'll need to have a web server installed and configured with PHP for this to work. I really recommend [XAMPP](https://www.apachefriends.org/), especially for Windows users. Once you've done that you can proceed. + +You'll also need [Node.js](https://nodejs.org/en/) and [npm](https://www.npmjs.com/) installed and working. + +## Configuration +A couple of files need changing to get the site working for you. + +1. Copy `config.yaml.dist` and rename it to `config.yaml`. Fill in the fields according to their descriptions and save. +2. Locate `blog.coffee` and fill in the `blogId` and `apiKey` fields to get your blog working. + +## Building +Clone the project down and open the folder in your favourite editor. It's a JetBrains PhpStorm project but you can use whichever paid/free software takes your fancy. + +Before anything else, note that this project uses the [Composer](https://getcomposer.org/) package manager. Install composer (see their website) and run: + +``` +composer install +``` + +Or alternatively, if you're using the PHAR (make sure the `php.exe` executable is in your PATH): + +``` +php composer.phar install +``` + +Then, install the npm packages necessary to build and run the website. Run the following in your terminal in the project root directory: + +``` +npm install +``` + +This will install [Bower](https://bower.io/) which will allow you to install the assets the website requires (Bootstrap, jQuery etc.) using the command: + +``` +bower install +``` + +Gulp will also have been installed. This will compile the [Less](http://lesscss.org/) and [CoffeeScript](http://coffeescript.org/) into CSS and JavaScript ready for production. Do this using the command: + +``` +gulp +``` + +This command will need running again every time you make a change to a Less or CoffeeScript file. If you're working on them, run `gulp watch` in a terminal to watch for file changes and compile accordingly. + +## Limitations + +I'm not a web designer. The site isn't going to bring a tear to your eye with its beauty. diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..b3dafe3 --- /dev/null +++ b/bower.json @@ -0,0 +1,20 @@ +{ + "name": "lambdacasserole/silex-base", + "version": "1.0.0", + "homepage": "https://github.com/lambdacasserole/silex-base", + "authors": [ + "Saul Johnson " + ], + "description": "Basic Silex project for a simple website.", + "keywords": [ + "basic", + "silex", + "simple", + "website" + ], + "license": "MIT", + "dependencies": { + "bootstrap": "~3.3.1", + "bootswatch": "^3.3.6" + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..d722576 --- /dev/null +++ b/composer.json @@ -0,0 +1,19 @@ +{ + "name": "lambdacasserole/silex-base", + "description": "Basic Silex project for a simple website.", + "type": "project", + "license": "MIT", + "authors": [ + { + "name": "Saul Johnson", + "email": "saul.a.johnson@gmail.com" + } + ], + "require": { + "silex/silex": "~2.0", + "twig/twig": "^1.24", + "mustangostang/spyc": "^0.5.1", + "intervention/image": "^2.4", + "guzzlehttp/guzzle": "^6.3" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..7c5088e --- /dev/null +++ b/composer.lock @@ -0,0 +1,982 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "5e740fc02164dd61e791ba1ae1a34860", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "6.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0 || ^5.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2017-06-22T18:50:49+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, + { + "name": "intervention/image", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "322a4ade249467179c50a3e50eda8760ff3af2a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/322a4ade249467179c50a3e50eda8760ff3af2a3", + "reference": "322a4ade249467179c50a3e50eda8760ff3af2a3", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "time": "2017-07-03T15:50:40+00:00" + }, + { + "name": "mustangostang/spyc", + "version": "0.5.1", + "source": { + "type": "git", + "url": "https://github.com/mustangostang/spyc.git", + "reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mustangostang/spyc/zipball/dc4785b4d7227fd9905e086d499fb8abfadf9977", + "reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5.x-dev" + } + }, + "autoload": { + "files": [ + "Spyc.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT License" + ], + "authors": [ + { + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" + } + ], + "description": "A simple YAML loader/dumper class for PHP", + "homepage": "https://github.com/mustangostang/spyc/", + "keywords": [ + "spyc", + "yaml", + "yml" + ], + "time": "2013-02-21T10:52:01+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2015-09-11T15:10:35+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21T11:40:51+00:00" + }, + { + "name": "silex/silex", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Silex.git", + "reference": "7420ac96195ea7eb6f1e11dc273be49359dd50ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Silex/zipball/7420ac96195ea7eb6f1e11dc273be49359dd50ad", + "reference": "7420ac96195ea7eb6f1e11dc273be49359dd50ad", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "pimple/pimple": "~3.0", + "symfony/event-dispatcher": "~2.8|^3.0", + "symfony/http-foundation": "~2.8|^3.0", + "symfony/http-kernel": "~2.8|^3.0", + "symfony/routing": "~2.8|^3.0" + }, + "replace": { + "silex/api": "self.version", + "silex/providers": "self.version" + }, + "require-dev": { + "doctrine/dbal": "~2.2", + "monolog/monolog": "^1.4.1", + "swiftmailer/swiftmailer": "~5", + "symfony/asset": "~2.8|^3.0", + "symfony/browser-kit": "~2.8|^3.0", + "symfony/config": "~2.8|^3.0", + "symfony/css-selector": "~2.8|^3.0", + "symfony/debug": "~2.8|^3.0", + "symfony/doctrine-bridge": "~2.8|^3.0", + "symfony/dom-crawler": "~2.8|^3.0", + "symfony/expression-language": "~2.8|^3.0", + "symfony/finder": "~2.8|^3.0", + "symfony/form": "~2.8|^3.0", + "symfony/intl": "~2.8|^3.0", + "symfony/monolog-bridge": "~2.8|^3.0", + "symfony/options-resolver": "~2.8|^3.0", + "symfony/phpunit-bridge": "~2.8|^3.0", + "symfony/process": "~2.8|^3.0", + "symfony/security": "~2.8|^3.0", + "symfony/serializer": "~2.8|^3.0", + "symfony/translation": "~2.8|^3.0", + "symfony/twig-bridge": "~2.8|^3.0", + "symfony/validator": "~2.8|^3.0", + "symfony/var-dumper": "~2.8|^3.0", + "twig/twig": "~1.8|~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Silex\\": "src/Silex" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "The PHP micro-framework based on the Symfony Components", + "homepage": "http://silex.sensiolabs.org", + "keywords": [ + "microframework" + ], + "time": "2016-06-14T09:27:51+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "06e2d52e307ef880ac739f44ee6c2418ca9e3283" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/06e2d52e307ef880ac739f44ee6c2418ca9e3283", + "reference": "06e2d52e307ef880ac739f44ee6c2418ca9e3283", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-06-29T05:41:56+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "7f9839ede2070f53e7e2f0849b9bd14748c434c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7f9839ede2070f53e7e2f0849b9bd14748c434c5", + "reference": "7f9839ede2070f53e7e2f0849b9bd14748c434c5", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2016-06-29T05:41:56+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "6b5a3764c5b0ce1f0ec3b8be5bba969122a78cfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6b5a3764c5b0ce1f0ec3b8be5bba969122a78cfc", + "reference": "6b5a3764c5b0ce1f0ec3b8be5bba969122a78cfc", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2016-06-29T07:02:31+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "3a1ce1829128988826739bd9dd820f3238b92d65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3a1ce1829128988826739bd9dd820f3238b92d65", + "reference": "3a1ce1829128988826739bd9dd820f3238b92d65", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0", + "symfony/debug": "~2.8|~3.0", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/http-foundation": "~2.8.8|~3.0.8|~3.1.2|~3.2" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "symfony/browser-kit": "~2.8|~3.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/css-selector": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/dom-crawler": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0", + "symfony/routing": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0", + "symfony/templating": "~2.8|~3.0", + "symfony/translation": "~2.8|~3.0", + "symfony/var-dumper": "~2.8|~3.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/class-loader": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2016-06-30T17:16:01+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "dff51f72b0706335131b00a7f49606168c582594" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", + "reference": "dff51f72b0706335131b00a7f49606168c582594", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-05-18T14:26:46+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "22c7adc204057a0ff0b12eea2889782a5deb70a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/22c7adc204057a0ff0b12eea2889782a5deb70a3", + "reference": "22c7adc204057a0ff0b12eea2889782a5deb70a3", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/http-foundation": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2016-06-29T05:41:56+00:00" + }, + { + "name": "twig/twig", + "version": "v1.24.1", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/3566d311a92aae4deec6e48682dc5a4528c4a512", + "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512", + "shasum": "" + }, + "require": { + "php": ">=5.2.7" + }, + "require-dev": { + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.24-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2016-05-30T09:11:59+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/config/config.yaml.dist b/config/config.yaml.dist new file mode 100644 index 0000000..2e7a6fa --- /dev/null +++ b/config/config.yaml.dist @@ -0,0 +1,12 @@ +# Don't commit this file to source control, it contains your secret settings. + +contact_form_from: ~ # This is the email address that contact form correspondence will be sent from. +contact_form_from_name: ~ # This is the name that contact form correspondence will be sent from. +contact_form_target: ~ # This is the email address that contact form correspondence will be sent to. +linkedin_url: ~ # The URL of your LinkedIn profile. +twitter_url: ~ # The URL of your Twitter profile. +github_url: ~ # The URL of your GitHub profile. +blogger_url: ~ # The URL of your blog on Blogger. +blogger_atom_url: ~ # The URL of your blog's Atom feed on Blogger. +chem_name_lookup_service: ~ # The URL of the service to use to look up chemical names. +sourire_service: ~ # The URL of the Sourire molecule rendering service. diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..df841ac --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,42 @@ +// Promise polyfill. +var Promise = require('es6-promise').Promise; + +// Gulp itself. +var gulp = require('gulp'); + +// Less and CSS stuff. +var less = require('gulp-less'); +var prefix = require('gulp-autoprefixer'); +var minifycss = require('gulp-minify-css'); +var coffee = require('gulp-coffee'); + +// Compile all the Less. +gulp.task('less', function () { + gulp.src(['./src/less/*.less']) + .pipe(less()) + .pipe(prefix( + "last 1 version", "> 1%", "ie 8", "ie 7" + )) + .pipe(minifycss()) // Minify resulting CSS. + .pipe(gulp.dest('./web/css')); +}); + +// Compile all the CoffeeScript. +gulp.task('coffee', function () { + gulp.src(['./src/coffee/*.coffee']) + .pipe(coffee()) + .pipe(gulp.dest('./web/js')); +}); + +gulp.task('watch', function() { + // Compile Less. + gulp.watch("./src/less/*.less", function(event) { + gulp.run('less'); + }); + // Compile CoffeeScript. + gulp.watch("./src/coffee/*.coffee", function(event) { + gulp.run('coffee'); + }); +}); + +gulp.task('default', ['less', 'coffee']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..6e3da85 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "silex-base", + "version": "1.0.0", + "description": "Basic Silex project for a simple website.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/lambdacasserole/silex-base" + }, + "keywords": [ + "basic", + "silex", + "simple", + "website" + ], + "author": "Saul Johnson", + "license": "MIT", + "bugs": { + "url": "https://github.com/lambdacasserole/silex-base/issues" + }, + "homepage": "https://github.com/lambdacasserole/silex-base", + "devDependencies": { + "bower": "~1.4.1", + "es6-promise": "^3.2.1", + "gulp": "^3.8.8", + "gulp-autoprefixer": "^3.1.0", + "gulp-coffee": "^2.2.0", + "gulp-less": "^1.3.6", + "gulp-minify-css": "^1.2.4" + } +} diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..067b6de Binary files /dev/null and b/screenshot.png differ diff --git a/screenshot_small.png b/screenshot_small.png new file mode 100644 index 0000000..4b850d0 Binary files /dev/null and b/screenshot_small.png differ diff --git a/src/coffee/blog.coffee b/src/coffee/blog.coffee new file mode 100644 index 0000000..825034d --- /dev/null +++ b/src/coffee/blog.coffee @@ -0,0 +1,21 @@ +blogId = "" # Your blog ID goes here. + +apiKey = "" # Your API key goes here. + +getUrl = "https://www.googleapis.com/blogger/v3/blogs/" + blogId + "/posts?key=" + apiKey + +buildItemHtml = (item) -> + result = "

" + item.title + "

" + result += "

By " + item.author.displayName + " " + result += "on " + new Date(item.published).toDateString() + "

" + result += "

" + item.content + "

" + return result + +loadBlog = () -> + $.getJSON getUrl, (data) -> + target = $ ".js-blog-posts" + for item in data.items + target.append buildItemHtml(item) + +$(document).ready () -> + loadBlog() diff --git a/src/less/main.less b/src/less/main.less new file mode 100644 index 0000000..992a7b1 --- /dev/null +++ b/src/less/main.less @@ -0,0 +1,108 @@ +@banner-giant-height: 300px; +@banner-giant-width: 480px; + +html { + min-width: @banner-giant-width; +} + +body { + margin-bottom: 50px; +} + +.banner-divider { + height: 1px; + width: 100%; + position: absolute; + left: 0; + background: rgba(0, 0, 0, 0.4); +} + +.buffer-left { + margin-left: 10px; +} + +.logo { + border-radius: 50px; +} + +.banner-giant { + position: relative; + top: 0; + left: 0; + background-image: url(../images/cover_1.png); + background-size: cover; + width: 100%; + height: @banner-giant-height; + margin-top: 61px; + + &-container { + height: @banner-giant-height; + width: @banner-giant-width; + margin: 0 auto; + } + + &-text { + height: @banner-giant-height; + width: @banner-giant-width; + text-align: center; + display: table-cell; + vertical-align: middle; + color: black; + } + + &-divider { + &-bottom { + .banner-divider(); + bottom: 0; + } + + &-top { + .banner-divider(); + top: 0; + } + } +} + +.banner-small { + position: relative; + top: 0; + left: 0; + background-image: url(../images/cover_1.png); + background-size: cover; + width: 100%; + height: 48px; + margin-top: 45px; +} + +.banner-giant-purple { + .banner-giant(); + background-image: url(../images/cover_3.png); +} + +.banner-giant-green { + .banner-giant(); + background-image: url(../images/cover_2.png); +} + +.banner-giant-orange { + .banner-giant(); + background-image: url(../images/cover_4.png); +} + +.banner-giant-turquoise { + .banner-giant(); + background-image: url(../images/cover_1.png); +} + +.banner-giant-lavender { + .banner-giant(); + background-image: url(../images/cover_5.png); +} + +.mt-plus { + margin-top: 16px; +} + +textarea.form-control { + height: 128px; +} \ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig new file mode 100644 index 0000000..c9cde93 --- /dev/null +++ b/templates/base.html.twig @@ -0,0 +1,114 @@ + + + + {% block title %}{% endblock %} - Silex Base + + + + + + + + + + + + + + + + + + + + + + + + + {% block styles %}{% endblock %} + + + + {% block scripts %}{% endblock %} + + + + {% block banner %} + {% endblock %} +
+ {% block content %} + {% endblock %} +
+
+
+
+
+
+
+

Legal

+ +
+
+

Lorem Ipsum

+

+ Aliquam erat volutpat. Nunc id orci quis nibh laoreet egestas. Suspendisse quis enim sapien. + Phasellus ut nunc vel diam cursus vulputate. Pellentesque nec eleifend felis. Duis quis + tincidunt sem. +

+
+
+

Communities

+ + + +
+
+
+
+
+
+
+
+
+ Copyright © Joe Bloggs 2016 +
+
+
+ + diff --git a/templates/blog.html.twig b/templates/blog.html.twig new file mode 100644 index 0000000..0ceab2e --- /dev/null +++ b/templates/blog.html.twig @@ -0,0 +1,32 @@ +{% extends "base.html.twig" %} + +{% block title %}Blog{% endblock %} + +{% block scripts %} + + +{% endblock %} + +{% block banner %} + +{% endblock %} + +{% block content %} +
+
+
+{% endblock %} diff --git a/templates/contact.html.twig b/templates/contact.html.twig new file mode 100644 index 0000000..72500b9 --- /dev/null +++ b/templates/contact.html.twig @@ -0,0 +1,73 @@ +{% extends "base.html.twig" %} + +{% block title %}Contact{% endblock %} + +{% block banner %} + +{% endblock %} + +{% block content %} +
+
+

Contact

+

+ Please use the form below to contact me. +

+ {% if post %} + {% if success %} +
+ +

Thank you for your message!

+

+ I'll get back to you as soon as I can. +

+
+ {% else %} +
+ +

Couple of problems...

+

+ There was a problem or two with some of the information you submitted. Please correct the + following and try again: +

+
    + {% for error in errors %} +
  • + {{ error }} +
  • + {% endfor %} +
+
+ {% endif %} + {% endif %} +
+
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
+
+

+ +

+
+
+
+{% endblock %} diff --git a/templates/index.html.twig b/templates/index.html.twig new file mode 100644 index 0000000..41c2713 --- /dev/null +++ b/templates/index.html.twig @@ -0,0 +1,59 @@ +{% extends "base.html.twig" %} + +{% block title %}Home{% endblock %} + +{% block banner %} + +{% endblock %} + +{% block content %} +
+
+

Lorem Ipsum

+

+ Aliquam erat volutpat. Nunc id orci quis nibh laoreet egestas. Suspendisse quis enim sapien. Phasellus ut + nunc vel diam cursus vulputate. Pellentesque nec eleifend felis. Duis quis tincidunt sem. Phasellus sagittis + magna sed ligula ultricies, at imperdiet metus condimentum. Sed aliquam libero ac urna porta, a euismod + lorem aliquet. +

+

Sed Lectus Diam

+
+

+ "Duis venenatis tincidunt ullamcorper." +

+

+ Integer mattis posuere orci, vel iaculis augue pellentesque porttitor. Morbi vitae tortor mi. Duis maximus + euismod laoreet. Cras tempor maximus augue sed faucibus. +

+ Donec porttitor nunc ligula, quis feugiat mi porttitor quis. Ut elementum mi sit amet finibus vulputate. Ut + vitae faucibus nisl, sed malesuada lacus. Pellentesque sit amet tortor commodo arcu facilisis ultricies. + Etiam convallis feugiat sapien, ac luctus diam pretium vitae. Duis et mi vulputate, condimentum justo ac, + tempus sem. +

+

+ Etiam id laoreet dolor. Sed cursus quam a hendrerit euismod. Proin orci urna, fermentum ut ullamcorper at, + fermentum quis sapien. Donec vel dictum dui. +

+

Fusce Mollis Elit Lectus

+

+ Aenean velit tellus, maximus vulputate ex id, bibendum venenatis purus. Nullam varius turpis ac arcu laoreet + semper. Sed mi purus, rutrum mattis sapien ac, malesuada accumsan tortor. Fusce turpis tellus, blandit ut + imperdiet ut, tempus in eros. +

+
+
+{% endblock %} diff --git a/templates/project-1.html.twig b/templates/project-1.html.twig new file mode 100644 index 0000000..ef79a13 --- /dev/null +++ b/templates/project-1.html.twig @@ -0,0 +1,40 @@ +{% extends "base.html.twig" %} + +{% block title %}Project 1{% endblock %} + +{% block banner %} + +{% endblock %} + +{% block content %} +
+
+

Project 1

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed orci in nulla ultrices porta et sed + felis. Aliquam aliquam leo nec maximus imperdiet. Suspendisse quis rhoncus felis, non vulputate est. + Vestibulum diam ex, suscipit sed est vel, fringilla sodales dui. Maecenas viverra consectetur risus in + hendrerit. Sed sit amet venenatis leo. Curabitur placerat pellentesque nunc, at eleifend massa scelerisque + ac. Suspendisse potenti. Donec semper nunc non est venenatis, ac lacinia tellus placerat. Proin vel est in + erat interdum vestibulum in in orci. Suspendisse hendrerit lorem dolor, nec ornare urna elementum fringilla. + Fusce malesuada nulla at eros porttitor, et maximus ipsum tristique. Maecenas vel mi nisi. Donec mattis, + tellus a pellentesque posuere, elit elit sagittis risus, venenatis condimentum lacus nibh sed velit. Donec + vestibulum nisl a est facilisis, ultricies consectetur ipsum varius. Suspendisse molestie scelerisque velit. +

+
+
+{% endblock %} diff --git a/templates/project-2.html.twig b/templates/project-2.html.twig new file mode 100644 index 0000000..16fcfab --- /dev/null +++ b/templates/project-2.html.twig @@ -0,0 +1,40 @@ +{% extends "base.html.twig" %} + +{% block title %}Project 2{% endblock %} + +{% block banner %} + +{% endblock %} + +{% block content %} +
+
+

Project 2

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed orci in nulla ultrices porta et sed + felis. Aliquam aliquam leo nec maximus imperdiet. Suspendisse quis rhoncus felis, non vulputate est. + Vestibulum diam ex, suscipit sed est vel, fringilla sodales dui. Maecenas viverra consectetur risus in + hendrerit. Sed sit amet venenatis leo. Curabitur placerat pellentesque nunc, at eleifend massa scelerisque + ac. Suspendisse potenti. Donec semper nunc non est venenatis, ac lacinia tellus placerat. Proin vel est in + erat interdum vestibulum in in orci. Suspendisse hendrerit lorem dolor, nec ornare urna elementum fringilla. + Fusce malesuada nulla at eros porttitor, et maximus ipsum tristique. Maecenas vel mi nisi. Donec mattis, + tellus a pellentesque posuere, elit elit sagittis risus, venenatis condimentum lacus nibh sed velit. Donec + vestibulum nisl a est facilisis, ultricies consectetur ipsum varius. Suspendisse molestie scelerisque velit. +

+
+
+{% endblock %} diff --git a/templates/project-3.html.twig b/templates/project-3.html.twig new file mode 100644 index 0000000..1654870 --- /dev/null +++ b/templates/project-3.html.twig @@ -0,0 +1,40 @@ +{% extends "base.html.twig" %} + +{% block title %}Project 3{% endblock %} + +{% block banner %} + +{% endblock %} + +{% block content %} +
+
+

Project 3

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed orci in nulla ultrices porta et sed + felis. Aliquam aliquam leo nec maximus imperdiet. Suspendisse quis rhoncus felis, non vulputate est. + Vestibulum diam ex, suscipit sed est vel, fringilla sodales dui. Maecenas viverra consectetur risus in + hendrerit. Sed sit amet venenatis leo. Curabitur placerat pellentesque nunc, at eleifend massa scelerisque + ac. Suspendisse potenti. Donec semper nunc non est venenatis, ac lacinia tellus placerat. Proin vel est in + erat interdum vestibulum in in orci. Suspendisse hendrerit lorem dolor, nec ornare urna elementum fringilla. + Fusce malesuada nulla at eros porttitor, et maximus ipsum tristique. Maecenas vel mi nisi. Donec mattis, + tellus a pellentesque posuere, elit elit sagittis risus, venenatis condimentum lacus nibh sed velit. Donec + vestibulum nisl a est facilisis, ultricies consectetur ipsum varius. Suspendisse molestie scelerisque velit. +

+
+
+{% endblock %} diff --git a/web/.htaccess b/web/.htaccess new file mode 100644 index 0000000..d1b713a --- /dev/null +++ b/web/.htaccess @@ -0,0 +1,9 @@ + + Options -MultiViews + + RewriteEngine On + #RewriteBase /path/to/app + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [QSA,L] + \ No newline at end of file diff --git a/web/images/cover_1.png b/web/images/cover_1.png new file mode 100644 index 0000000..e4dae04 Binary files /dev/null and b/web/images/cover_1.png differ diff --git a/web/images/cover_2.png b/web/images/cover_2.png new file mode 100644 index 0000000..88eeba2 Binary files /dev/null and b/web/images/cover_2.png differ diff --git a/web/images/cover_3.png b/web/images/cover_3.png new file mode 100644 index 0000000..6f412f1 Binary files /dev/null and b/web/images/cover_3.png differ diff --git a/web/images/cover_4.png b/web/images/cover_4.png new file mode 100644 index 0000000..46b289e Binary files /dev/null and b/web/images/cover_4.png differ diff --git a/web/images/cover_5.png b/web/images/cover_5.png new file mode 100644 index 0000000..934ea81 Binary files /dev/null and b/web/images/cover_5.png differ diff --git a/web/images/favicon/android-icon-144x144.png b/web/images/favicon/android-icon-144x144.png new file mode 100644 index 0000000..1364f76 Binary files /dev/null and b/web/images/favicon/android-icon-144x144.png differ diff --git a/web/images/favicon/android-icon-192x192.png b/web/images/favicon/android-icon-192x192.png new file mode 100644 index 0000000..957d030 Binary files /dev/null and b/web/images/favicon/android-icon-192x192.png differ diff --git a/web/images/favicon/android-icon-36x36.png b/web/images/favicon/android-icon-36x36.png new file mode 100644 index 0000000..f59c0e5 Binary files /dev/null and b/web/images/favicon/android-icon-36x36.png differ diff --git a/web/images/favicon/android-icon-48x48.png b/web/images/favicon/android-icon-48x48.png new file mode 100644 index 0000000..2938e17 Binary files /dev/null and b/web/images/favicon/android-icon-48x48.png differ diff --git a/web/images/favicon/android-icon-72x72.png b/web/images/favicon/android-icon-72x72.png new file mode 100644 index 0000000..a515146 Binary files /dev/null and b/web/images/favicon/android-icon-72x72.png differ diff --git a/web/images/favicon/android-icon-96x96.png b/web/images/favicon/android-icon-96x96.png new file mode 100644 index 0000000..0ed3ad6 Binary files /dev/null and b/web/images/favicon/android-icon-96x96.png differ diff --git a/web/images/favicon/apple-icon-114x114.png b/web/images/favicon/apple-icon-114x114.png new file mode 100644 index 0000000..3b8297f Binary files /dev/null and b/web/images/favicon/apple-icon-114x114.png differ diff --git a/web/images/favicon/apple-icon-120x120.png b/web/images/favicon/apple-icon-120x120.png new file mode 100644 index 0000000..7f9d2eb Binary files /dev/null and b/web/images/favicon/apple-icon-120x120.png differ diff --git a/web/images/favicon/apple-icon-144x144.png b/web/images/favicon/apple-icon-144x144.png new file mode 100644 index 0000000..1364f76 Binary files /dev/null and b/web/images/favicon/apple-icon-144x144.png differ diff --git a/web/images/favicon/apple-icon-152x152.png b/web/images/favicon/apple-icon-152x152.png new file mode 100644 index 0000000..c119193 Binary files /dev/null and b/web/images/favicon/apple-icon-152x152.png differ diff --git a/web/images/favicon/apple-icon-180x180.png b/web/images/favicon/apple-icon-180x180.png new file mode 100644 index 0000000..99f7297 Binary files /dev/null and b/web/images/favicon/apple-icon-180x180.png differ diff --git a/web/images/favicon/apple-icon-57x57.png b/web/images/favicon/apple-icon-57x57.png new file mode 100644 index 0000000..0eabc0e Binary files /dev/null and b/web/images/favicon/apple-icon-57x57.png differ diff --git a/web/images/favicon/apple-icon-60x60.png b/web/images/favicon/apple-icon-60x60.png new file mode 100644 index 0000000..5685350 Binary files /dev/null and b/web/images/favicon/apple-icon-60x60.png differ diff --git a/web/images/favicon/apple-icon-72x72.png b/web/images/favicon/apple-icon-72x72.png new file mode 100644 index 0000000..a515146 Binary files /dev/null and b/web/images/favicon/apple-icon-72x72.png differ diff --git a/web/images/favicon/apple-icon-76x76.png b/web/images/favicon/apple-icon-76x76.png new file mode 100644 index 0000000..7bd6211 Binary files /dev/null and b/web/images/favicon/apple-icon-76x76.png differ diff --git a/web/images/favicon/apple-icon-precomposed.png b/web/images/favicon/apple-icon-precomposed.png new file mode 100644 index 0000000..24369de Binary files /dev/null and b/web/images/favicon/apple-icon-precomposed.png differ diff --git a/web/images/favicon/apple-icon.png b/web/images/favicon/apple-icon.png new file mode 100644 index 0000000..24369de Binary files /dev/null and b/web/images/favicon/apple-icon.png differ diff --git a/web/images/favicon/browserconfig.xml b/web/images/favicon/browserconfig.xml new file mode 100644 index 0000000..c554148 --- /dev/null +++ b/web/images/favicon/browserconfig.xml @@ -0,0 +1,2 @@ + +#ffffff \ No newline at end of file diff --git a/web/images/favicon/favicon-16x16.png b/web/images/favicon/favicon-16x16.png new file mode 100644 index 0000000..8bf9562 Binary files /dev/null and b/web/images/favicon/favicon-16x16.png differ diff --git a/web/images/favicon/favicon-32x32.png b/web/images/favicon/favicon-32x32.png new file mode 100644 index 0000000..b4d06ba Binary files /dev/null and b/web/images/favicon/favicon-32x32.png differ diff --git a/web/images/favicon/favicon-96x96.png b/web/images/favicon/favicon-96x96.png new file mode 100644 index 0000000..0ed3ad6 Binary files /dev/null and b/web/images/favicon/favicon-96x96.png differ diff --git a/web/images/favicon/favicon.ico b/web/images/favicon/favicon.ico new file mode 100644 index 0000000..3b81461 Binary files /dev/null and b/web/images/favicon/favicon.ico differ diff --git a/web/images/favicon/manifest.json b/web/images/favicon/manifest.json new file mode 100644 index 0000000..013d4a6 --- /dev/null +++ b/web/images/favicon/manifest.json @@ -0,0 +1,41 @@ +{ + "name": "App", + "icons": [ + { + "src": "\/android-icon-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/android-icon-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/android-icon-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/android-icon-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/android-icon-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/android-icon-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] +} \ No newline at end of file diff --git a/web/images/favicon/ms-icon-144x144.png b/web/images/favicon/ms-icon-144x144.png new file mode 100644 index 0000000..1364f76 Binary files /dev/null and b/web/images/favicon/ms-icon-144x144.png differ diff --git a/web/images/favicon/ms-icon-150x150.png b/web/images/favicon/ms-icon-150x150.png new file mode 100644 index 0000000..be6264c Binary files /dev/null and b/web/images/favicon/ms-icon-150x150.png differ diff --git a/web/images/favicon/ms-icon-310x310.png b/web/images/favicon/ms-icon-310x310.png new file mode 100644 index 0000000..99d9c0c Binary files /dev/null and b/web/images/favicon/ms-icon-310x310.png differ diff --git a/web/images/favicon/ms-icon-70x70.png b/web/images/favicon/ms-icon-70x70.png new file mode 100644 index 0000000..ae5405c Binary files /dev/null and b/web/images/favicon/ms-icon-70x70.png differ diff --git a/web/images/github.svg b/web/images/github.svg new file mode 100644 index 0000000..086c2be --- /dev/null +++ b/web/images/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/images/icon.png b/web/images/icon.png new file mode 100644 index 0000000..7b613a9 Binary files /dev/null and b/web/images/icon.png differ diff --git a/web/images/linkedin.svg b/web/images/linkedin.svg new file mode 100644 index 0000000..192eb9d --- /dev/null +++ b/web/images/linkedin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/images/twitter.svg b/web/images/twitter.svg new file mode 100644 index 0000000..f323c89 --- /dev/null +++ b/web/images/twitter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/index.php b/web/index.php new file mode 100644 index 0000000..f694841 --- /dev/null +++ b/web/index.php @@ -0,0 +1,144 @@ + 'gd')); + +$config = Spyc::YAMLLoad(__DIR__.'/../config/config.yaml'); // Load config. + +$app = new Silex\Application(); + +// Uncomment the line below while debugging your app. +$app['debug'] = true; + +// Twig initialization. +$loader = new Twig_Loader_Filesystem(__DIR__.'/../templates'); +$twig = new Twig_Environment($loader, array( + 'cache' => __DIR__.'/../cache', +)); + +/* + * Route actions. + */ + +$app->get('/', function () use ($twig, $config) { + return $twig->render('index.html.twig', $config); +}); + +$app->get('/contact', function () use ($twig, $config) { + return $twig->render('contact.html.twig', $config); +}); + +$app->post('/contact', function () use ($twig, $config) { + // Collect form fields. + $name = $_POST['name']; + $email = $_POST['email']; + $message = $_POST['message']; + + // Validate form. + $errors = []; + if (strlen($name) < 2) { + $errors[] = 'The name you provide needs to 2 or more characters in length.'; + } + if (strlen($message) < 30) { + $errors[] = 'The message you submit needs to be 30 or more characters in length.'; + } + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + $errors[] = 'The email address you provided is invalid.'; + } + + // Send message if no errors. + if (sizeof($errors) == 0) { + + // Prepare headers. + $headers = 'MIME-Version: 1.0' . "\r\n"; + $headers .= 'From: ' . $config['contact_form_from_name'] . ' <' . $config['contact_form_from'] . '>' . "\r\n"; + $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; + + mail($config['contact_form_target'], 'Website contact', "Name: $name\r\nWebsite: $website\r\nEmail: $email\r\nMessage: $message", $headers); + } + + // Render contact page with success/error message. + $vars = array_merge($config, array( + 'success' => sizeof($errors) == 0, + 'errors' => $errors, + 'post' => $_POST + )); + return $twig->render('contact.html.twig', $vars); +}); + +$app->get('/linkedin', function () use ($twig, $config) { + header('Location: ' . $config['linkedin_url']); + die(); +}); + +$app->get('/twitter', function () use ($twig, $config) { + header('Location: ' . $config['twitter_url']); + die(); +}); + +$app->get('/github', function () use ($twig, $config) { + header('Location: ' . $config['github_url']); + die(); +}); + +$app->get('/project-1', function () use ($twig, $config) { + return $twig->render('project-1.html.twig', $config); +}); + +$app->get('/project-2', function () use ($twig, $config) { + return $twig->render('project-2.html.twig', $config); +}); + +$app->get('/project-3', function () use ($twig, $config) { + return $twig->render('project-3.html.twig', $config); +}); + +$app->get('/blog', function () use ($twig, $config) { + return $twig->render('blog.html.twig', $config); +}); + +$app->get('/api/smiles/{width}/{height}/{bgcolor}/{fgcolor}/{smiles}', function ($width, $height, $bgcolor, $fgcolor, $smiles) use ($twig, $config) { + + // Set up background. + $img = Image::canvas($width, $height, "#$bgcolor"); + + // Proxy into Sourire for molecule render. + $molecule = Image::make('http://localhost:8080/molecule/' . urlencode($smiles)); + + // Colorize molecule. + list($r, $g, $b) = sscanf($fgcolor, "%02x%02x%02x"); + $n = 100 / 255; + $molecule->colorize($n * $r, $n * $g, $n * $b); + + // Center molecule on background. + $img->insert($molecule, 'center'); + + // Send image out + echo $img->response(); +}); + +$app->get('/api/name/{width}/{height}/{bgcolor}/{fgcolor}/{name}', function ($width, $height, $bgcolor, $fgcolor, $name) use ($app, $twig, $config) { + + // Convert chemical name to SMILES if we can. + $client = new GuzzleHttp\Client(['verify' => false, 'exceptions'=>false]); + $res = $client->request('GET', str_replace('$name', $name, $config['chem_name_lookup_service'])); + + if ($res->getStatusCode() == 200) { + + // Forward to SMILES route. + $smiles = $res->getBody(); + $smilesRequest = Request::create("/api/smiles/$width/$height/$bgcolor/$fgcolor}/$smiles", 'GET'); + return $app->handle($smilesRequest, HttpKernelInterface::SUB_REQUEST); + } else { + + // Invalid chemical name. + $app->abort(404, "Chemical name could not be converted to SMILES."); + } +}); + +$app->run();