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:7100937
Created October 22, 2013 13:39
FB.ui 回po訊息到塗鴉牆上
FB.ui({
method: 'feed',
name: '<?= $fb_share_title; ?>',
link: '<?= current_url(); ?>',
picture: '<?= $fb_share_img; ?>',
//caption: '<?= $meta_description;?>',
description: '<?= $fb_share_text; ?>'
},
function(response) {
if (response && response.post_id) {
@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:29f9da3136f5d9c71af7
Created November 17, 2014 00:37
Sublime Text 必安裝的套件
官網上 TOP100 的套件都值得一看(https://sublime.wbond.net/browse/popular),以下這些套件不分前後端都是強烈推薦安裝:
SideBarEnhancements // 增強側欄功能
BracketHighlighter // 大小括號的匹配自訂顏色提醒
DocBlockr // 產生對應的各種程式語言的註解
SublimeCodeIntel // syntax 檢驗
emmet // HTML的簡碼快速輸入
EasyMotion // 很有趣的快速純鍵盤游標移動
FileDiffs // 檔案差異比對、也可以跟其他檔案比對,或是比對剪貼簿的內容。
All Autocomplete // 自動補齊此套件可以加強到批配所有開啟的分頁
@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>