Skip to content

Instantly share code, notes, and snippets.

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

Yu Li liyu001989

🏠
Working from home
View GitHub Profile
@liyu001989
liyu001989 / HashIdHelper.php
Last active September 19, 2019 02:37
HashIdHelper
<?php
namespace App\Models\Traits;
use Hashids;
trait HashIdHelper
{
private $hashId;
certbot certonly -d '*.liyu.wiki' --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory
@liyu001989
liyu001989 / vimrc
Last active May 25, 2021 15:19
Laravel-vimrc
"建议插件的加载放在最开始,否则可能有加载问题例theme
"可以单独写个文件进行加载例如:
"so ~/.vim/plugins.vim
"--------插件--------
call plug#begin('~/.vim/plugged')
Plug '907th/vim-auto-save'
"Plug 'StanAngeloff/php.vim'
"中文帮助
Plug 'yianwillis/vimcdoc'
@liyu001989
liyu001989 / .php_cs.dist
Last active February 23, 2018 01:54
php-cs-fixer v2 config for Laravel/Lumen
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$fixers = [
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_equals' => false,
@liyu001989
liyu001989 / select2.vue
Created February 6, 2017 04:30
select2 plugin with in vue
<style scoped>
.select2-container--default .select2-selection--multiple,.select2-selection--single {
border-radius: 0;
}
</style>
<template>
<select style="width: 100%" :name="name" multiple="multiple">
<slot></slot>
</select>
@liyu001989
liyu001989 / hmac.php
Last active December 15, 2016 04:44
hmac sign and verify
<?php
function sign($signKey = '', Array $params = [])
{
// 去除空值
$params = array_filter($params);
ksort($params);
$signParams = [];
@liyu001989
liyu001989 / .php_cs
Created October 30, 2016 14:15
laravel/lumen use php-cs-fixer
<?php
$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/cache')
->notPath('storage')
->notPath('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
@liyu001989
liyu001989 / isset-post-user.php
Last active October 8, 2016 02:26
isset 再 php7 中出现的问题
<?php
class Model
{
// 存放属性
protected $attributes = [];
// 存放关系
protected $relations = [];
@liyu001989
liyu001989 / laravel-rest.js
Last active June 12, 2018 07:21
laravel make post or delete method from a <a> link use bootbox
require(['jquery', 'bootbox'], function($, bootbox) {
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
var laravel = {
initialize: function() {