Skip to content

Instantly share code, notes, and snippets.

View wzulfikar's full-sized avatar
Set status

Wildan Zulfikar wzulfikar

Set status
View GitHub Profile
wzulfikar / l5-validator.php
Last active December 4, 2015 13:20
example of manual validation and throwing its exception in laravel 5.
* 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:
public function store(Request $request){
// make the validator.
// $rules & $messages are associative array.
// see:
wzulfikar / summernote-upload-image.js
Created December 4, 2015 13:45
attaching image in summernote editor (ajax)
* Super simple WYSIWYG editor using Bootstrap.
$(document).ready(function() {
// init summernote with height: 200px
height: 200,
wzulfikar / l5-common
Last active December 5, 2015 14:22
things i used commonly in laravel
# 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){
wzulfikar / .zshrc
Last active November 16, 2016 03:07
# 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
wzulfikar / library
Created September 2, 2016 15:02
Snippets I use with Dash (OSX) -
# the upper line is how we call the snippet,
# below it is content of the snippet.
wzulfikar / brew.txt
Last active November 3, 2016 00:29
`brew`-ing my mac
# install brew
/usr/bin/ruby -e "$(curl -fsSL" # <- see:
# 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
wzulfikar / populateInputValues.js
Last active September 28, 2016 08:03
Populate HTML input values with given object via jQuery
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()) !!});
wzulfikar / diffTo.php
Last active September 20, 2016 07:30
Get seconds difference from current time to given time. Will always compare closest time.
function diffTo($toTime)
$now = strtotime('now');
$next = strtotime('today ' . $toTime);
if($next <= $now){
$next = strtotime('tomorrow ' . $toTime);
This document has been created with <>
Please leave this notice in place, along with any additional credits below.
Title: Ulysses Freestraction Light
Author: Jonathan Poritsky <>
Description: Based on the Freestraction color scheme used in Ulysses III <>.
For more information read the introductory post:
wzulfikar / iStat Menus Settings.ismp
Created September 20, 2016 09:59
My preferred settings for iStat Menus (
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">