- 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
| Widget buildClickableTextWithPadding() { | |
| return InkWell( | |
| onTap: () {}, | |
| child: Padding( | |
| padding: const EdgeInsets.symmetric(vertical: 8.0), | |
| child: Text.rich( | |
| TextSpan( | |
| children: [ | |
| TextSpan( | |
| text: 'Edit', |
| import 'package:flutter/material.dart'; | |
| /// Enum for selecting floating widget's initial alignment | |
| enum WidgetAlignment { | |
| /// The widget will be positioned of top left corner of the parent | |
| topLeft, | |
| /// The widget will be positioned of top right corner of the parent | |
| topRight, |
| /* | |
| Create SLUG from a string | |
| This function rewrite the string prototype and also | |
| replace latin and other special characters. | |
| Forked by Gabriel Froes - https://gist.github.com/gabrielfroes | |
| Original Author: Mathew Byrne - https://gist.github.com/mathewbyrne/1280286 | |
| */ | |
| if (!String.prototype.slugify) { | |
| String.prototype.slugify = function () { |
| /* | |
| Quick extension to bootstrap grid system to allow for a column | |
| to occupy one fifth of a row (i.e. five columns in a row). | |
| */ | |
| $col-5th-width: 12 / 5; // 1/5 of 12 = 2.4 | |
| // SMALL | |
| .col-sm-5th { |
At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)
Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.
| alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("") | |
| base = alphabet.length | |
| exports.encode = (i) -> | |
| return alphabet[0] if i is 0 | |
| s = "" | |
| while i > 0 | |
| s += alphabet[i % base] | |
| i = parseInt(i / base, 10) |