Skip to content

Instantly share code, notes, and snippets.

@chrisliuqq
chrisliuqq / gist:96de1ef8160a1d41b6af315c6fb611f3
Last active October 4, 2017 11:15
[PHP] Laravel: override the dd helper function

bootstrap/app.php

+require_once __DIR__.'/../app/helpers.php';
require_once __DIR__.'/../vendor/autoload.php';

app/helpers.php

<?php
/usr/local/share/jre1.8.0_121/bin/java -server \
-d64 \
-Xmx14G \
-XX:NewRatio=3 -XX:+UseThreadPriorities \
-XX:SoftRefLRUPolicyMSPerMB=2048 \
-XX:CMSInitiatingOccupancyFraction=90 \
-XX:MaxGCPauseMillis=50 \
-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled \
-XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking \
-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 \

Keybase proof

I hereby claim:

  • I am chrisliuqq on github.
  • I am chrisliu (https://keybase.io/chrisliu) on keybase.
  • I have a public key whose fingerprint is 04EE 2D4E 4783 7EBE 43D0 505B 0FE7 60A3 8A16 CDD8

To claim this, I am signing this object:

@chrisliuqq
chrisliuqq / git usage.md
Last active December 9, 2016 03:59
git 操作的備忘

取得 git 上昨天開始與現在的所有修改

git diff $(git rev-list -n1 --before="1 day ago" master)

從所有 commit 中刪除特定檔案

remove a file from a git repository with:

git filter-branch --tree-filter 'rm file'
@chrisliuqq
chrisliuqq / poe.filter
Last active April 19, 2016 07:45
POE filter
# 顯示有品質的寶石
Show
Class Gem
Quality > 0
SetBorderColor 128 128 255
# 五連以上
Show
LinkedSockets >= 5
SetBackgroundColor 0 128 0
# 貨幣
@chrisliuqq
chrisliuqq / model.php
Created March 16, 2016 08:33
get laravel table schema in model
<?php
public function getTableColumns()
{
return $this->getConnection()->getSchemaBuilder()->getColumnListing($this->getTable());
}
@chrisliuqq
chrisliuqq / php.php
Last active June 4, 2019 08:14
How to use laravel Auth::user() outside laravel and pass data in custom php?
The solution above for 5.2 should still work. In 5.5+ you just need to change bootstrap/autoload.php to vendor/autoload.php.
<?php
require '/path/to/laravel/vendor/autoload.php';
$app = require_once '/path/to/laravel/bootstrap/app.php';
$app->make('Illuminate\Contracts\Http\Kernel')
->handle(Illuminate\Http\Request::capture());

Jenkins Port Forwarding (8080 -> 80) with pf on Mavericks/Yosemite

This guide is a fork from this gist. I've added minor adjustments to customise these rules to forward connections from an outsite interface like en0.

Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

1. Create the anchor file

Create an anchor file under /etc/pf.anchors/com.jenkins with your redirection rule like:

@extends('admin.layout')
@section('content')
<h1 class="page-header">新增文章</h1>
@if (count($errors->all()) > 0 )
<div class="alert alert-danger" role="alert">
@foreach ($errors->all() as $error)
<p>{{ $error }}</p>
@endforeach
</div>
@endif
@chrisliuqq
chrisliuqq / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console