Skip to content

Instantly share code, notes, and snippets.

View prinsss's full-sized avatar
🐟
摸鱼中

prin prinsss

🐟
摸鱼中
View GitHub Profile
@prinsss
prinsss / printempw.pub
Last active January 16, 2020 15:28
我的 PGP 公钥:B51137BF34A36F0652241A816FC03E5D3F409A40
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFkgK7UBCADiDZCI37cTPEGW9hHP0AcsVItwozCjjd2bGdNoxOdINiQKHuaX
ILDipjwM1MgaLDculcbzH/LekviL8IKqwJbqWsNJfG6OW2WPUvn+UbCOdBzp2+Be
QO4vNFEaZGINeZ5cQuXU/+Z8kV0TauIqc3ngGxF4F/Kp1PNLtX8j5+LoV68pcTUt
ojmHXDc2gfFtH/bxAcZtpXyU2KgKGJab6ojOc/EE72qUe/+T/fiEhqQ+vUPdUgMe
Zl3CCi2+h9pe75lm2mlNi+jQjG/mS499bCgfFfZUAICniO0KKja++Wox4v/uDCyz
B/FRg5uuZJaliaWD8EF6AS5IP0NLpXJkqkDnABEBAAG0JjYyMXNhbWEgKHByaW50
ZW1wdykgPGhAcHJpbnpldWdlbi5uZXQ+iQE2BBMBCgAgBQJZICu1AhsDBQsJCAcD
<?php
namespace App\Services;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Contracts\Support\Arrayable;
/**
* @property string $name
{
"configurations": [
{
"name": "MinGW G++",
"intelliSenseMode": "gcc-x64",
"compilerPath": "C:\\Portable\\mingw64\\bin\\g++.exe",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
@prinsss
prinsss / .travis.yml
Last active November 8, 2018 15:16
Travis CI config for Hexo blog automatic deployment.
language: node_js
node_js: stable
# 只监听 source 分支的改动
branches:
only:
- source
# 缓存依赖,节省持续集成时间
cache:
@prinsss
prinsss / count_universal.php
Last active September 15, 2018 14:38
Ghost page view counter, support both MySQL and SQLite.
<?php
/**
* @Author: printempw
* @Date: 2016-01-31 17:08:29
* @Last Modified by: prpr
* @Last Modified time: 2016-02-02 16:31:55
*
* Database type, `mysql` or `sqlite`
*/
define('DB_TYPE', 'mysql');
@prinsss
prinsss / robbyrussell-makaizou-local.zsh-theme
Last active April 20, 2018 18:37
Modified Zsh theme, Robby Russell Makaizou. Added user@hostname prompt which is convenient for VPS management.
# For local shell, prompt is lik this
# ➜ blessing-skin-server git:(master)$
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%{$reset_color%}%{$fg_bold[blue]%}$ %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
$('.load-gist').on('click', function() {
var gist = {
// URL 传参自己改下
url: '//gist.github.com/printempw/' + $(this).data('hash') + '.json?callback=?',
dom: this
}
// 因为 URL 中带了 `callback=?`,所以这里 jQuery 会使用 JSONP 方式请求
$.getJSON(gist.url, function(data) {
// 加载样式
@prinsss
prinsss / example.js
Created June 25, 2017 05:03
Hexo 访问计数器,前端示例脚本。
/**
* 这里处理一下 slug,去掉多余字符。
* Hexo 博客中的页面(即 layout 为 page)的 `page.path` 会带上一个 `index.html`,搞不懂为什么。
*/
String.prototype.cleanSlug = function () {
var search = '/index.html';
if (this.indexOf(search) === -1) {
return this.slice(0, -1)
} else {
@prinsss
prinsss / lib.js
Created June 11, 2017 14:16
依赖于 jQuery 的纯前端生成文章目录(Table of Contents)。本来是为了辣鸡 Ghost 博客写的,可惜我现在要投奔 Hexo 了 ( ̄3 ̄)
/**
* 差不多就是把一些项目中的现有代码黏在一起,能用而已。目前实现的功能有:
*
* - 生成 TOC(废话)
* - 滚动监听(高亮当前项目)
* - 点击跳转
*/
// https://github.com/ghiculescu/jekyll-table-of-contents
(function($){
@prinsss
prinsss / isEmpty.js
Created September 16, 2016 04:37
Check if given object empty.
function isEmpty(obj) {
// null and undefined are "empty"
if (obj == null) return true;
// Assume if it has a length property with a non-zero value
// that that property is correct.
if (obj.length > 0) return false;
if (obj.length === 0) return true;