Skip to content

Instantly share code, notes, and snippets.

View guanguans's full-sized avatar
🏠
Working from home

guanguans guanguans

🏠
Working from home
View GitHub Profile
@guanguans
guanguans / sublime-settings.json
Last active June 3, 2020 03:15 — forked from overtrue/Preferences.sublime-settings
sublime-settings.json
{
"always_show_minimap_viewport": true,
"atomic_save": true,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
@guanguans
guanguans / .gitignore
Last active June 3, 2020 03:15 — forked from overtrue/.gitignore
global.gitignore
# 设置方法:
# git config --global core.excludesfile ~/.gitignore_global
#compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
@guanguans
guanguans / deploy.php
Last active March 14, 2019 03:50 — forked from overtrue/gist:0bf1cd704bf804de2e2c
deploy.php
<?php
error_reporting(1);
$target = __DIR__ . '/../website.com'; // 生产环境web目录
$token = '您在coding填写的hook令牌';
$wwwUser = 'apache';
$wwwGroup = 'apache';
$json = json_decode(file_get_contents('php://input'), true);
version: '2'
services:
# The Application
app:
build:
context: ./
dockerfile: php-fpm.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
@guanguans
guanguans / download.php
Created August 29, 2020 06:36 — forked from beyerz/download.php
Symfony console, download remote file with progress bar using guzzle
/**
* @param SymfonyStyle $io
* @param $remotePath
*
* @return string
*/
public function download(SymfonyStyle $io, $remotePath)
{
$io->section("Download " . $remotePath);
$parts = parse_url($remotePath);
@guanguans
guanguans / README.md
Created October 9, 2020 07:21 — forked from Eotones/README.md
speechSynthesis強制使用Chrome中的Google小姐中文語音

speechSynthesis強制使用Chrome中的Google小姐中文語音

網路上的window.speechSynthesis教學主要都只有說切換指定語言

像是這樣就能切換成中文語音:

const synth = window.speechSynthesis;

const speak = (msg) => {
@guanguans
guanguans / Laravel-Container.md
Created March 2, 2022 19:15
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@guanguans
guanguans / long-running-curl-sse.php
Created December 16, 2022 09:48 — forked from kinlane/long-running-curl-sse.php
Long Running PHP CURL Requests To Handle Server Sent Events (SSE)
<?php
// prepare headers for API call
$request_headers = array();
// prepare the url of the api I am calling
$api_url = "http://api.example.com?parameters=whatever";
// append streamdata sandbox proxy
$url = 'https://streamdata.motwin.net/' . $api_url;