This is a quick (somewhat) reference for tools we can use in our development workflow.
-
COMPOSER Package and Dependency management for PHP
cd ~/Downloadscurl -sS https://getcomposer.org/installer | php
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| @if(empty($title)) | |
| <title>Company</title> | |
| @else | |
| <title>{{ $title }} | Company</title> | |
| @endif | |
| <link rel="stylesheet" type="text/css" href="/css/reusify.css"> |
| .ir { | |
| font: 0px/0px monospace; | |
| text-shadow: none; | |
| color: transparent; | |
| } |
This is a quick (somewhat) reference for tools we can use in our development workflow.
COMPOSER Package and Dependency management for PHP
cd ~/Downloads
curl -sS https://getcomposer.org/installer | php
| <?php | |
| // PDO Connection to MySQL | |
| $conn = new PDO('mysql:host=localhost;dbname=yourdbname', 'username', 'password'); | |
| // PDO Connection to PostgreSQL | |
| $conn = new PDO('pgsql:host=localhost;dbname=yourdbname', 'username', 'password'); | |
| // A quick Select Query with For Loop | |
| foreach ($conn->query("SELECT * FROM profile") as $row) | |
| echo $row['fullname']; |
| <?php | |
| define('GRAVATAR', 'http://www.gravatar.com/avatar/'); | |
| /** | |
| * Requesting an image from gravatar.com | |
| * | |
| * @param str email The email address to use | |
| * @param str size The desired image size i.e: 120 (images are square) | |
| * @param boo wrap Whether to wrap the image in an <img> tag |
| <?php | |
| namespace Craft; | |
| /** | |
| * @=Path: A wrapper for the Craft Path Service API | |
| * | |
| * Path allows you to access the API in a very flexible and elegant way. | |
| * | |
| * @author Selvin Ortiz |
| <?php | |
| /** | |
| * SplClassLoader implementation that implements the technical interoperability | |
| * standards for PHP 5.3 namespaces and class names. | |
| * | |
| * http://groups.google.com/group/php-standards/web/final-proposal | |
| * | |
| * // Example which loads classes for the Doctrine Common package in the | |
| * // Doctrine\Common namespace. |
| <?php | |
| /** | |
| * @=ENV | |
| * | |
| * @author Selvin Ortiz (http://twitter.com/selvinortiz) | |
| * | |
| * 1. Define the craft path relative to this file | |
| * 2. Define the domain name this site is running under | |
| * 3. Define the ip address that requested this resource | |
| * 4. Define the environment we are working under |
| {% extends "_abstract/master.twig" %} | |
| {% set title = "Spam Guard" %} | |
| {% set bodyId = "spamguard" %} | |
| {% block content %} | |
| {% if spam is defined %} | |
| {% set email = spam.email %} | |
| {% set author = spam.author %} | |
| {% set content = spam.content %} |
| {% extends "_abstract/master.twig" %} | |
| {% set bodyId = 'flux' %} | |
| {% block content %} | |
| {% set url = 'http://www.selvinortiz.com' %} | |
| {% | |
| set flux = craft.flux | |
| .startOfLine() | |
| .find('http') | |
| .maybe('s') |