Skip to content

Instantly share code, notes, and snippets.

View bobo52310's full-sized avatar
🎯
Focusing

Bobo Chen (陳柏宏) bobo52310

🎯
Focusing
View GitHub Profile
@bobo52310
bobo52310 / gist:5032859d52c21b09a49d
Created June 25, 2014 02:42
實戰驚豔 Laravel 給你的5個驚嘆號 by Bobo
欣賞新一代 PHP Framework Laravel 帶給你的便利與驚嘆!
Laravel 火力展示,給您安心使用的理由
Laravel 如何解決傳統開發遇到的痛點,演示5個驚嘆號
總結,Q&A 交流

###Jeffrey Way (1) - Bootcamp

Jeffrey went through about 12 subjects one right after the other and gave tips along the way.

  1. Mail Drivers for mail notifications.
1. With Laravel 4.2 it’s easier to use APIs like Mailgun and Mandrill for e-mail notifications. This avoids using SMTP which is really cool.
  1. File Generators for generating schema migrations.
熟悉 shell
Mac Terminal神器 iTerm2
設定教學 http://chimerhapsody.blogspot.tw/2013/08/iterm2.html
gerp // 正規表示式進行檔案搜尋,顯示出 “列"
awk // 正規表示式進行檔案搜尋,顯示出 “欄"
// 參考 http://ithelp.ithome.com.tw/question/10136126
sort -r // 將結果依條件進行排序 (-r反轉排序)
[程式碼自動編排]
:set equalprg=perltidy //針對特定區塊重新排列程式碼
選擇文字區塊按下 = 鍵可進行格式化。
shift + v // VISUAL LINE
ctrl + v // VISUAL BLOCK
@bobo52310
bobo52310 / note_pivot_table
Last active August 29, 2015 14:06
隨筆Note:Many to Many Relationships in Laravel
紀錄多對多關聯的第三張表叫做 pivot table
在 pivot 新增一筆紀錄 role_id = 2
$user->roles()->attach(2);
刪除某筆 pivot table 的紀錄
User::find(1)->roles()->detach();
有需要為pivot table建立 model嗎
不需要,使用pivot取值即可操作pivot table,
$group->pivot->post_id
[{"name":"questions","color":"Green","position":{"x":100,"y":100},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"title","type":"string","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c23","order":0},{"name":"language_name","type":"string","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c31","order":1},{"name":"group_id","type":"integer","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":true,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c39","order":2}],"relation":[],"seeding":[]}]
[{"name":"questions","color":"Green","position":{"x":100,"y":100},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"title","type":"string","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c23","order":0},{"name":"language_name","type":"string","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c31","order":1},{"name":"group_id","type":"integer","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":true,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c39","order":2}],"relation":[{"extramethods":"","foreignkeys":"","name":"function_name","relatedmodel":"menus","relationtype":"hasMany","usenamespace":""}],"seeding":[]},{"name":"menus","color":"Red","pos
@bobo52310
bobo52310 / gist:b1e27223b5932aec2a08
Last active August 29, 2015 14:11
INITIALISE RAPTOR Error message in Chrome Browser
<body>
<script type="text/javascript" src="/javascripts/raptor.min.js"></script>
<div class="raptor-editable" data-id="main-content">
<p>
Raptor may be integrated into a site many ways.
This article aims to cover the simplest integration possible.
</p>
</div>
<script>
@bobo52310
bobo52310 / gist:d894b5594abc3ba6932a
Created December 17, 2014 07:32
file_manager_error
Warning: require_once(/Users/bobochen/Desktop/github/raptor-example/..//raptor-themes/include.php): failed to open stream: No such file or directory in /Users/bobochen/Desktop/github/raptor-example/partials/head.php on line 15
Fatal error: require_once(): Failed opening required '/Users/bobochen/Desktop/github/raptor-example/..//raptor-themes/include.php' (include_path='.:/usr/local/Cellar/php55/5.5.19/lib/php') in /Users/bobochen/Desktop/github/raptor-example/partials/head.php on line 15
@bobo52310
bobo52310 / gist:c919f838df574490c1c2
Last active August 29, 2015 14:11
raptor-editor-replace-textarea
<textarea class="form-control input" data-id="main-content" name="body" ></textarea>
<div class="raptor-editable">
<div class="raptor-editable input" style="background-color: rgba(245, 217, 165, 0.28);"></div>
</div>
<script>
$(document).ready(function() {
$('.raptor-editable').raptor({
autoEnable: true, // Enable the editor automaticly
unloadWarning: false,