This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* It is manual because L5 base controller uses `ValidatesRequests` trait | |
* which helps a lot so that we only need to code `$this->validate($request, $rules, $messages)` | |
* from our controller (which extends L5 controller). see: http://laravel.com/docs/5.1/validation. | |
*/ | |
public function store(Request $request){ | |
// make the validator. | |
// $rules & $messages are associative array. | |
// see: http://laravel.com/docs/5.1/validation#manually-creating-validators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/** | |
* Super simple WYSIWYG editor using Bootstrap. | |
* https://github.com/summernote/summernote | |
*/ | |
$(document).ready(function() { | |
// init summernote with height: 200px | |
$('.summernote').summernote({ | |
height: 200, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate migration file and use `tasks` as table name | |
php artisan make:migration create_tasks_table --create=tasks | |
# `migrate` what we defined in migration file to database | |
php artisan migrate | |
# Display all SQL executed in Eloquent | |
Event::listen('illuminate.query', function($query){ | |
var_dump($query); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config aliases | |
alias so="source" | |
alias zshso="source ~/.zshrc" | |
alias zshconfig="subl ~/.zshrc" | |
alias sshconfig="subl ~/.ssh/config" | |
alias hostsconfig="subl /etc/hosts" # <- edit hosts file using sublime | |
alias omz="subl ~/.oh-my-zsh" | |
alias subl-user="open ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User" | |
# directory aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the upper line is how we call the snippet, | |
# below it is content of the snippet. | |
clog` | |
console.log(@cursor); | |
date` | |
@date | |
time` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install brew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # <- see: http://brew.sh | |
# before `brew`-ing everything else | |
brew update && brew doctor | |
# quicklook plugins | |
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package | |
brew install zsh-syntax-highlighting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var populateInputValues = function(o) { | |
$.each(o, function(name, val){ | |
$('input[name="' + name + '"]').val(val); | |
}); | |
} | |
// sample usage via laravel blade | |
<script type="text/javascript"> | |
populateInputValues({!! json_encode(request()->all()) !!}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function diffTo($toTime) | |
{ | |
$now = strtotime('now'); | |
$next = strtotime('today ' . $toTime); | |
if($next <= $now){ | |
$next = strtotime('tomorrow ' . $toTime); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This document has been created with Marked.app <http://marked2app.com> | |
Please leave this notice in place, along with any additional credits below. | |
--------------------------------------------------------------- | |
Title: Ulysses Freestraction Light | |
Author: Jonathan Poritsky <http://candlerblog.com> | |
Description: Based on the Freestraction color scheme used in Ulysses III <http://www.ulyssesapp.com>. | |
For more information read the introductory post: http://candlerblog.com/2013/04/11/ulysses-iii-and-marked/ | |
*/ |
OlderNewer