- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
| #!/bin/sh | |
| printf "Switching php to version 5.6 with symlinks.\n" | |
| printf "Press any key to continue...\n" | |
| read CONTINUE | |
| printf "Creating backups..." | |
| # Backup original binaries |
| <?php | |
| /** | |
| * Description of VideoStream | |
| * | |
| * @author Rana | |
| * @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial | |
| */ | |
| class VideoStream | |
| { | |
| private $path = ""; |
| <?php | |
| namespace App\Http; | |
| /** | |
| * Description of VideoStream | |
| * | |
| * @author Rana | |
| * @link https://gist.github.com/vluzrmos/d5682ad426525196d069 | |
| */ |
| <?php | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Sharing Laravel's session and checking authentication | |
| |-------------------------------------------------------------------------- | |
| | | |
| | Use the following code in any CMS (WordPress, Joomla, etc), filemanager (CKFinder, | |
| | KCFinder, simogeos's Filemanager, etc), or any other non-Laravel project to boot into | |
| | the Laravel framework, with session support, and check if the user is authenticated. |
| /* | |
| ******************************************************************************** | |
| Golang - Asterisk and Ampersand Cheatsheet | |
| ******************************************************************************** | |
| Also available at: https://play.golang.org/p/lNpnS9j1ma | |
| Allowed: | |
| -------- | |
| p := Person{"Steve", 28} stores the value |
| #!/bin/sh | |
| rpm -Uih https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm | |
| curl -L https://get.rvm.io | bash -s stable | |
| rvm install 2.1.2 | |
| rvm use 2.1.2@global --default | |
| # for chinese user, if you have a wonderful speed ignore this part | |
| # to have a faster download speed | |
| # switch gem source to ruby.taobao.org |
| var waitForEl = function(selector, callback) { | |
| if (jQuery(selector).length) { | |
| callback(); | |
| } else { | |
| setTimeout(function() { | |
| waitForEl(selector, callback); | |
| }, 100); | |
| } | |
| }; |
| // --- Compiling --- | |
| $ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
| $ tar xzvf redis-2.8.3.tar.gz | |
| $ cd redis-2.8.3 | |
| $ make | |
| $ make install | |
| // --- or using yum --- | |
| $ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
| $ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |