This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
| #!/usr/bin/php | |
| <?php | |
| /** | |
| * .git/hooks/pre-commit | |
| * | |
| * This pre-commit hooks will check for PHP error (lint), and make sure the code | |
| * is PSR compliant. | |
| * | |
| * Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer) | |
| * |
| <?php | |
| class Shopware_Plugins_Frontend_OrderMod_Bootstrap extends Shopware_Components_Plugin_Bootstrap | |
| { | |
| /** | |
| * (non-PHPdoc) | |
| * @see Shopware_Components_Plugin_Bootstrap::install() | |
| */ | |
| public function install() | |
| { |
| <?php | |
| /** | |
| * Classes source autoload | |
| */ | |
| class Varien_Autoload | |
| { | |
| /** @var \Composer\Autoload\ClassLoader */ | |
| private static $autoloader; | |
| /** @var self */ |
| #include <SPI.h> | |
| #include <Ethernet.h> | |
| // Thx http://bildr.org/2012/11/force-sensitive-resistor-arduino/ | |
| // Make use of https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide | |
| // MAC Address, needed by the Ethernet Shield | |
| byte mac[] = { 0xB0, 0xC0, 0xDE, 0xEF, 0xFE, 0xC7 }; | |
| int pin_red = 7; // Red LED |
| alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'" |
| function freierTag($tag, $monat, $jahr) | |
| { | |
| // Parameter in richtiges Format bringen | |
| if(strlen($tag) == 1) { | |
| $tag = "0$tag"; | |
| } | |
| if(strlen($monat) == 1) { | |
| $monat = "0$monat"; | |
| } |
The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
| // An anonymous function written in lambda syntax: | |
| x => x + 1 | |
| val func = x => x + 1 | |
| func(3) // returns 4 | |
| // In this case, the lambda `x => x + 1` relies on NO external data. | |
| // It's fundamentally complete. X is provided as an argument to the function. |