Skip to content

Instantly share code, notes, and snippets.

View Maras0830's full-sized avatar

Maras Chen Maras0830

View GitHub Profile
@Maras0830
Maras0830 / nginx.conf
Created October 25, 2017 06:01
laravel multiple project config.
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.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
'api' => [
'driver' => 'passport',
'provider' => 'users'
],
@Maras0830
Maras0830 / TestCase.php
Created April 20, 2017 05:06
Laravel tests/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
*/
@Maras0830
Maras0830 / notification.js
Created April 6, 2017 03:23
web notification
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 March 22, 2017 06:04
nginx.conf with prerender.io
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 March 15, 2017 09:33
[nginx] same domain map to different project. [Vuex(vue-route) + Laravel]
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 January 23, 2017 04:06
Extract Superclass and Extract Closure

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 December 23, 2016 09:44
Laravel53-passport-server/routes/api.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 December 23, 2016 08:52
Laravel53-passport-server/routes/api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These