Skip to content

Instantly share code, notes, and snippets.

View entimm's full-sized avatar
🤒
Out sick

entimm entimm

🤒
Out sick
View GitHub Profile
@sanpingz
sanpingz / _vimrc
Last active March 28, 2017 02:14
vim配置文件
cd C:\Users\Calvin
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
@KushalP
KushalP / .tmux.reset.conf
Created August 14, 2013 10:13
If someone's added their own tmux config in /etc/tmux.conf this will reset all key bindings to the default for tmux
# First remove *all* keybindings
unbind-key -a
# Now reinsert all the regular tmux keys
bind-key C-b send-prefix
bind-key C-o rotate-window
bind-key C-z suspend-client
bind-key Space next-layout
bind-key ! break-pane
bind-key \" split-window
@mylxsw
mylxsw / logstash-biz-logs.conf
Last active August 26, 2018 11:50
logstash-biz-logs.conf
input {
beats {
port => 5044
}
}
filter {
if [log_type] == "php_slow" {
# php 慢查询日志
ruby {
@dhrrgn
dhrrgn / DataContainer.php
Last active December 21, 2020 02:30
Data Container Class and Trait
<?php
use ArrayAccess;
use Countable;
use IteratorAggregate;
class DataContainer implements ArrayAccess, Countable, IteratorAggregate
{
use DataContainerTrait;
}
@marktopper
marktopper / PageController.php
Last active December 24, 2020 20:55
[Voyager] Routes for Pages BREAD
<?php
class PageController extends \App\Http\Controllers\Controller
{
public function show()
{
$slug = request()->segment(1);
$page = \TCG\Voyager\Models\Page::where('slug', $slug)
->firstOrFail();
@martincarlin87
martincarlin87 / deploy.php
Last active October 2, 2021 20:39
Deployer Laravel 5 Example
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Configuration
set('ssh_type', 'native');
set('repository', '[REPO URL]');
set('branch', 'master');
set('keep_releases', 5);
@mtttmpl
mtttmpl / relative-time.php
Created September 29, 2012 16:51
Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks')
<?php
function time2str($ts) {
if(!ctype_digit($ts)) {
$ts = strtotime($ts);
}
$diff = time() - $ts;
if($diff == 0) {
return 'now';
} elseif($diff > 0) {
$day_diff = floor($diff / 86400);
@stuby
stuby / rPrint example.txt
Created April 23, 2013 17:54
This is a handy recursive data printer.
> rPrint({first={true,1.3,"abc",{1,2,5}},22,33,last={nil,5},2},nil,"Junk")
Junk table
Junk [1] number 22
Junk [2] number 33
Junk [3] number 2
Junk [last] table
Junk [last] [2] number 5
Junk [first] table
Junk [first] [1] boolean true
Junk [first] [2] number 1.3
@nebiros
nebiros / mb_str_pad.php
Created November 4, 2009 20:30
mb_str_pad
<?php
/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @return string
@why404
why404 / nginx_conf_with_annotation.conf
Created December 29, 2009 15:26
Nginx配置说明
# 指定Nginx工作的用户和用户组,www-data 是我们新建的一个虚拟用户
user www-data www-data;
# 指定Nginx工作的进程数,默认是1。建议参考CPU内核数,双核处理器又是超线程的话可以设置为4个,避免进程堵塞在IO等待中。
worker_processes 4;
events {
use epoll; # 指定I/O模式,epoll是Linux内核2.6(或以上)中一种比较高效的异步IO模型
worker_connections 8000; # 规定单个进程可以处理的请求数