Skip to content

Instantly share code, notes, and snippets.

@Maras0830
Maras0830 / nginx.conf
Created Oct 25, 2017
laravel multiple project config.
View nginx.conf
server {
listen 80;
listen [::]:80;
root /var/www/Service/laravel_datacenter_api/public/;
server_name api.4gamers.dev;
index index.php index.html index.htm;
# resource v0,v1 api.
View gist:c3c3b4175196f3401523484aca424c85
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
@Maras0830
Maras0830 / TestCase.php
Created Apr 20, 2017
Laravel tests/TestCase.php
View TestCase.php
<?php
use Illuminate\Support\Facades\Artisan;
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
*/
View notification.js
var socket_lottery_io = io.connect(location.origin + ':3033');
socket_lottery_io.on('lotteryNotification', function(data) {
setLotteryNotification(data);
});
function setLotteryNotification(data) {
Notification.requestPermission(function(status) {
if (status === 'granted') {
@Maras0830
Maras0830 / dev4g.com.tw.conf
Last active Mar 22, 2017
nginx.conf with prerender.io
View dev4g.com.tw.conf
server {
listen 80;
listen [::]:80;
server_name www.dev4g.com.tw;
return 301 https://$server_name$request_uri;
}
server {
@Maras0830
Maras0830 / project.dev.conf
Created Mar 15, 2017
[nginx] same domain map to different project. [Vuex(vue-route) + Laravel]
View project.dev.conf
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;
@Maras0830
Maras0830 / superclass.md
Last active Jan 23, 2017
Extract Superclass and Extract Closure
View superclass.md

Closure function

Test.php

Class Test extends AbstractTest {

	public function calculateFee(array $weightArray, int $amount) : int
	{
        	$weights = $this->arrayToCollection($weightArray);
@Maras0830
Maras0830 / routes-web.php
Created Dec 23, 2016
Laravel53-passport-server/routes/api.php
View routes-web.php
Route::group(['prefix' => '/user', 'middleware' => 'auth:api'], function (){
Route::get('/', function (Request $request) {
return $request->user();
});
Route::get('/facebook_information', function (Request $request) {
return "Hello " . $request->user()->name . " got Facebook information!";
})->middleware('scope:Facebook_information');
@Maras0830
Maras0830 / routes-api.php
Created Dec 23, 2016
Laravel53-passport-server/routes/api.php
View routes-api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
You can’t perform that action at this time.