- 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
<?php | |
require_once('base_facebook.php'); | |
require_once('facebook.php'); | |
// Credentials | |
$fb_app_id = '***************'; | |
$fb_app_secret = '********************************'; | |
$facebook = new Facebook(array('appId'=>$fb_app_id, 'secret'=>$fb_app_secret, 'cookie'=>true)); |
/* Author: Brynner Ferreira (brynner.net) */ | |
// Functions | |
function removeHtmlStorage(name) { | |
localStorage.removeItem(name); | |
localStorage.removeItem(name+'_time'); | |
} | |
function setHtmlStorage(name, value, expires) { | |
if (expires==undefined || expires=='null') { var expires = 3600; } // default: 1h | |
var date = new Date(); | |
var schedule = Math.round((date.setSeconds(date.getSeconds()+expires))/1000); |
<?php | |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> | |
* @copyright Copyright 2012 Sean Murphy. All rights reserved. |
//*********** IMPORTS ***************** | |
var gulp = require('gulp'); | |
var sass = require('gulp-ruby-sass'); | |
var gutil = require('gulp-util'); | |
var rename = require("gulp-rename"); | |
var map = require("map-stream"); | |
var livereload = require("gulp-livereload"); | |
var concat = require("gulp-concat"); | |
var uglify = require('gulp-uglify'); | |
var watch = require('gulp-watch'); |
{ | |
"name": "MeuProjeto", | |
"version": "1.0.0", | |
"dependencies": { | |
"gulp": "*", | |
"gulp-ruby-sass": "*", | |
"gulp-util": "*", | |
"gulp-rename": "*", | |
"map-stream": "*", | |
"gulp-livereload": "*", |
//== Media queries breakpoints | |
// Extra small screen / phone | |
$screen-xs: 480px; | |
$screen-xs-min: $screen-xs; | |
// Small screen / tablet | |
$screen-sm: 768px; | |
$screen-sm-min: $screen-sm; |
FROM php:7.0.12-apache | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Install the PHP extensions I need for my personnal project (gd, mbstring, opcache) | |
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libpq-dev git mysql-client-5.5 wget \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ | |
&& docker-php-ext-install gd mbstring opcache pdo zip |
// Add data to HTML according to object´s property name | |
function addContentFromDataToHtml(object, dataSet) { | |
recursiveObject({object: object, callback: addContentFromDataToHtmlCallback, dataSet: dataSet}); | |
} | |
function recursiveObject(recursiveParams) { | |
if (recursiveParams.parentsItem) { | |
recursiveParams.parentsItem = recursiveParams.parentsItem+'.'; | |
} else { | |
recursiveParams.parentsItem = ''; | |
} |
I'm an admin. |