- 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; | |
server_name localhost; | |
root /Users/YOUR_USERNAME/Sites; | |
access_log /Library/Logs/default.access.log main; | |
location / { | |
include /usr/local/etc/nginx/conf.d/php-fpm; | |
} |
/** | |
* for send object between fragment, activity, service... | |
* REMEMBER: dispose if not in use to avoid leak memory | |
*/ | |
public class RxBus<T> { | |
private static final String PREFIX = "$^%)@"; | |
private static RxBus instance; | |
private PublishSubject<BusMessage<T>> subject = PublishSubject.create(); |
<?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
Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.
But before we dive in let us first define what web scraping is. According to Wikipedia:
{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}
/** | |
* Generates the string for the Haversine function. We assume that the `zipcode`, `latitude`, | |
* and `longitude` columns are named accordingly. We are also not doing much error-checking | |
* here; this is a simple text cruncher to make things prettier. | |
* We may also be integrating some extra SQL in, passed in via the $extra parameter | |
* | |
* @param string $table The table to search in | |
* @param float $lat The latitude part of the reference coordinates | |
* @param float $lng The longitude part of the reference coordinates | |
* @param int $radius The radius to search within |
/* | |
Umm Al-Qura Islamic Calendar | |
valid from 1356 AH (14 March 1937 CE) to 1500 AH (16 November 2077 CE). | |
Outside this interval, the converter will give erroneous results. | |
ported from javascript from: | |
http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm#top | |
*/ | |
import java.util.Calendar; |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="red_50">#fde0dc</color> | |
<color name="red_100">#f9bdbb</color> | |
<color name="red_200">#f69988</color> | |
<color name="red_300">#f36c60</color> | |
<color name="red_400">#e84e40</color> | |
<color name="red_500">#e51c23</color> |