- 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 | |
| // Output screenshot: | |
| // http://cl.ly/NsqF | |
| // ------------------------------------------------------- | |
| include_once 'console.php'; | |
| // ::log method usage | |
| // ------------------------------------------------------- | |
| Console::log('Im Red!', 'red'); |
as found on StackOverflow
And this command to restart my php-fpm:
brew services restart php71
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
| <?php | |
| // API access key from Google API's Console | |
| define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
| $registrationIds = array( $_GET['id'] ); | |
| // prep the bundle | |
| $msg = array |
| // WEEK | |
| Calendar first = Calendar.getInstance(); | |
| first.add(Calendar.DAY_OF_WEEK, first.getFirstDayOfWeek() - first.get(Calendar.DAY_OF_WEEK)); | |
| int startWeek = first.get(Calendar.DATE); | |
| int endWeek = startWeek + 6; | |
| // MONTH | |
| // start = 1 | |
| Calendar date = Calendar.getInstance(); |
| package com.grasys.shortupload.helper; | |
| import android.app.ProgressDialog; | |
| import android.content.Context; | |
| import android.content.DialogInterface; | |
| import android.os.AsyncTask; | |
| import java.io.BufferedInputStream; | |
| import java.io.BufferedReader; | |
| import java.io.DataOutputStream; |
| /** | |
| * convert milisec to hh:MM:ss | |
| * @param millisUntilFinished | |
| * @return String time | |
| */ | |
| public static String convertMilisecToHMmSs(long millisUntilFinished) { | |
| return String.format("%02d:%02d:%02d", | |
| TimeUnit.MILLISECONDS.toHours(millisUntilFinished), | |
| TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) - TimeUnit.HOURS.toMinutes( | |
| TimeUnit.MILLISECONDS.toHours(millisUntilFinished)), |