As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.
This file contains hidden or 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 | |
| /** | |
| * In this example, we are autoloading classes within the namespace `Acme\ExampleProject`. The file `index.php` is the | |
| * entry point to our project; and we are using the `src` directory to store and organize our PHP class files. Our | |
| * autoloader is located in `autoload.php` | |
| * | |
| * The basic behavior is illustrated in the fact that PHP will autoload the file `src/mammals/human.php` whenever we | |
| * attempt to create a `new \Acme\ExampleProject\Mammals\Human` anywhere in our project's codebase. | |
| * | |
| * This diagram illustrates our project structure. Each file's contents can be found below. |
This file contains hidden or 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 io = require('socket.io').listen(8000), | |
| nicknames = {}; | |
| io.sockets.on('connection', function (socket) { | |
| socket.on('user message', function (msg) { | |
| socket.broadcast.emit('user message', socket.nickname, msg); | |
| }); | |
| socket.on('nickname', function (nick, fn) { | |
| if (nicknames[nick]) { |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset='UTF-8' /> | |
| <style type="text/css"> | |
| <!-- | |
| .chat_wrapper { | |
| width: 500px; | |
| margin-right: auto; | |
| margin-left: auto; |
This file contains hidden or 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 | |
| // Based on <https://github.com/mecha-cms/extend.minify> | |
| define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\''); | |
| define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/'); | |
| define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>'); | |
| define('MINIFY_COMMENT_JS', '//[^\n]*'); | |
| define('MINIFY_PATTERN_JS', '\b/[^\n]+?/[gimuy]*\b'); | |
| define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>'); |