- 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
| server { | |
| listen 80; | |
| listen [::]:80; | |
| server_name test.dev; | |
| root /var/www/project1/public; | |
| index index.php index.html index.htm; | |
| location / { | |
| try_files $uri $uri/ /index.php$is_args$args; |
| import firebase from 'firebase' | |
| import { filter, map } from 'lodash' | |
| import { makeExecutableSchema } from 'graphql-tools' | |
| firebase.initializeApp({ | |
| databaseURL: 'https://grafire-b1b6e.firebaseio.com', | |
| }) | |
| const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() }) | |
| const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value })) |
| //actual function (must be a named function declaration for use w/ toString here) | |
| function addOne(x){ return x+1 }; | |
| //the actual worker code can be written as a string | |
| //template literals make that convienient because they support multiline | |
| //note that the addOne function above can be used in this worker code, since we'll be importing it | |
| const workerScript = ` | |
| self.addEventListener('message', function(e) { | |
| var data = e.data; | |
| console.log('worker recieved: ',data); |
| function loadMeatOf(name, list) { | |
| var deferred = Promise.defer(); | |
| http.get('http://localhost:8080/meta/' + name, function(response) { | |
| var responseBody = ""; // will hold the response body as it comes | |
| // join the data chuncks as they come | |
| response.on('data', function(chunck) { responseBody += chunck }); |
| public function index(){ | |
| $categoryList = Category::all(); | |
| return view('category.list')->with('categoryList', $categoryList); | |
| } |
Press minus + shift + s and return to chop/fold long lines!