Skip to content

Instantly share code, notes, and snippets.

@wzulfikar
wzulfikar / library
Created September 2, 2016 15:02
Snippets I use with Dash (OSX) - https://kapeli.com/dash
# the upper line is how we call the snippet,
# below it is content of the snippet.
clog`
console.log(@cursor);
date`
@date
time`
@wzulfikar
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
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){
var_dump($query);
});
@wzulfikar
wzulfikar / summernote-upload-image.js
Created December 4, 2015 13:45
attaching image in summernote editor (ajax)
<script>
/**
* Super simple WYSIWYG editor using Bootstrap.
* https://github.com/summernote/summernote
*/
$(document).ready(function() {
// init summernote with height: 200px
$('.summernote').summernote({
height: 200,
@wzulfikar
wzulfikar / l5-validator.php
Last active December 4, 2015 13:20
example of manual validation and throwing its exception in laravel 5.
<?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