Skip to content

Instantly share code, notes, and snippets.

View mul14's full-sized avatar
:octocat:
Preparing for big things...

Mulia Nasution mul14

:octocat:
Preparing for big things...
View GitHub Profile
@mul14
mul14 / README.md
Last active July 22, 2020 02:31
Laravel 5 Artisan Route List Filter Command

Copy RouteListFilterCommand.php to app/Console/Commands

Edit app/Console/Kernel.php, then add 'App\Console\Commands\RouteFilterCommand', to $commands, like so

protected $commands = [
	'App\Console\Commands\Inspire',
	'App\Console\Commands\RouteFilterCommand',
];
@mul14
mul14 / deploy.rb
Created March 22, 2015 00:52
Deploy Laravel 4 with mina http://mina-deploy.github.io/mina/
require 'mina/git'
# Fix the SSH password prompt problem
set :term_mode, nil
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)
@mul14
mul14 / calc.php
Created March 29, 2015 06:51
PHP Chaining method example
<?php
class Calc {
protected $value;
public static function create()
{
return new self;
}
@mul14
mul14 / .aliases.sh
Created August 28, 2015 04:34
Useful Aliases for me
#!/usr/bin/env sh
alias ping8='ping 8.8.8.8'
alias pingg='ping google.com'
alias ls='ls --group-directories-first --color -F --time-style=long-iso'
alias lsd='ls -l | grep "^d"'
alias lsf='ls -l | grep "^-"'
alias mkdir='mkdir -p'
@mul14
mul14 / README.md
Last active February 10, 2023 00:55
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
@mul14
mul14 / ImageTrait.php
Last active November 10, 2020 15:14
Easy to get image from a model - Laravel
<?php
namespace App;
use Gregwar\Image\Image;
use Symfony\Component\HttpFoundation\File\UploadedFile;
trait ImageTrait
{
protected $imageWidth, $imageHeight;
@mul14
mul14 / lang.blade.php
Last active October 21, 2015 04:55
Laravel and JavaScript Localization - Example
var lang = {
required => "{{ trans('required') }}",
email => "{{ trans('email') }}",
};
@mul14
mul14 / delete_node_modules.sh
Last active July 23, 2018 15:04
Delete all node_modules and bower_components directories
#!/usr/bin/env sh
find . -maxdepth 2 -type d -name node_modules -name bower_components -print0 | xargs -0 rm -rf
@mul14
mul14 / facebook-video-regex
Created December 6, 2015 05:55
Facebook Video URL Regex
http://regexr.com/3cbrm
^http(?:s?):\/\/(?:www\.|web\.|m\.)?facebook\.com\/([A-z0-9\.]+)\/videos(?:\/[0-9A-z].+)?\/(\d+)(?:.+)?$