Skip to content

Instantly share code, notes, and snippets.

Avatar

刘兵 iflamed

View GitHub Profile
@iflamed
iflamed / PassportToken.php
Last active Apr 4, 2018
Laravel Passport Generate Access_token By User Model
View PassportToken.php
<?php
namespace App\Traits;
use App\User;
use DateTime;
use GuzzleHttp\Psr7\Response;
use Illuminate\Events\Dispatcher;
use Laravel\Passport\Bridge\AccessToken;
use Laravel\Passport\Bridge\AccessTokenRepository;
@iflamed
iflamed / ssl.conf
Last active Apr 8, 2017
The letsencrypt nginx config and issue shell script
View ssl.conf
server {
listen 443 http2 ssl;
server_name example.com www.example.com;
ssl_certificate /home/user/.acme.sh/example.com_ecc/fullchain.cer;
ssl_certificate_key /home/user/.acme.sh/example.com_ecc/example.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_stapling on;
ssl_stapling_verify on;
@iflamed
iflamed / squarebox.css
Created Apr 2, 2017
纯css实现正方形框,通过变形:after伪元素的margin-top 的值还可以实现其它比例的高度。
View squarebox.css
.responsive-bg {
display: block;
width: 100%;
background-color: #fff;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
overflow: hidden;
}
.responsive-bg:after {
@iflamed
iflamed / MentionBlot.js
Created Mar 12, 2017
Quilljs MentionBlot
View MentionBlot.js
var Base = Quill.import('blots/embed');
/**
* This custom type of Blot is used to represent a Mention.
* It stores 2 values, a Name and an ID.
* The Name is used as a text to display within the input.
*/
class MentionBlot extends Base {
static create(data) {
@iflamed
iflamed / android.txt
Created Aug 26, 2016
Android 应用包获取签名
View android.txt
因为 Android 的开放性, 可能是出于安全考虑, 微信 SDK 除了核对应用包名外, 还会核对应用签名, 所以调试 Android 时, 需要保证应用签名与提交审核的签名一致.
首先, 应用务必要通过审核. 至于审核后修改签名是否立即生效, 我没有做验证.
获得最终可用的应用签名的前提是, 应用是以自己的生成的 keystore 签名的, 所以第一个问题应该是, 如何生成自己的 keystore.
JDK 有一个叫 keytool 的工具可以做这个, 一般情况下既然 Cordova 能正常用, 默认 JDK 已经加入 PATH 了, 那么可以直接运行下面的命令.
keytool -genkey -alias [别名] -keyalg RSA -validity 20000 -keystore [文件名.keystore]
别名要记下来, 之后会用到.
@iflamed
iflamed / installAndroidSDKOnMac.md
Created Aug 26, 2016 — forked from Erichain/installAndroidSDKOnMac.md
Mac OS下安装和配置android-sdk
View installAndroidSDKOnMac.md

##MAC OS下安装和配置android-sdk

###安装

在MAC上安装android-sdk,标准的安装方法是使用homebrew,运行如下命令:

brew update

brew install android-sdk

@iflamed
iflamed / android.js
Created May 5, 2016
SPA单页面应用在切换hash的时候,往往要更改页面标题,一般是通过document.title来设置。 但是iOS 或者微信里面是有坑的,需要hack 一下
View android.js
// eg.1
document.title='new title'
//eg.2
document.getElementsByTagName('title')[0].innerHTML = 'new title'
//这个方式 只能够在android 下面生效
@iflamed
iflamed / index.html
Created Apr 25, 2016
Sticky footer layout
View index.html
<body>
<header>...</header>
<section class="main-content">...</section>
<footer>...</footer>
</body>
View mysql-grant-remote-access.sql
-- Don't forget to replace »password« with a strong password.
create user 'username'@'localhost' identified by 'password';
grant all privileges on *.* to 'username'@'yourip' IDENTIFIED BY 'password' with grant option;
flush privileges;
@iflamed
iflamed / full_chain.pem
Last active Nov 3, 2015
A ssl example file, which get a grade A+
View full_chain.pem
-----BEGIN CERTIFICATE-----
MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB
hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV
BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMjEy
MDAwMDAwWhcNMjkwMjExMjM1OTU5WjCBkDELMAkGA1UEBhMCR0IxGzAZBgNVBAgT
EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
Q09NT0RPIENBIExpbWl0ZWQxNjA0BgNVBAMTLUNPTU9ETyBSU0EgRG9tYWluIFZh
bGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAI7CAhnhoFmk6zg1jSz9AdDTScBkxwtiBUUWOqigwAwCfx3M28Sh