Skip to content

Instantly share code, notes, and snippets.

View mrofi's full-sized avatar
🏠
work from home

Mokhamad Rofiudin mrofi

🏠
work from home
View GitHub Profile
@mrofi
mrofi / SublimeLinter.sublime-setting
Created February 19, 2016 10:52
PHPCS - SublimeLinter
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"php": {
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs\yoursite.dev"
ServerName yoursite.dev
<Directory "C:\xampp\htdocs\yoursite.dev">
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
@mrofi
mrofi / index.php
Created December 24, 2015 02:26
index.php to list all files in directory. just like apache did but it can be done in php built in server
<?php
$dir = __DIR__; // Directory where files are stored
if ($dir_list = opendir($dir))
{
while($files[] = readdir($dir_list));
sort($files);
closedir($dir_list);
foreach ($files as $file)
@mrofi
mrofi / nginx-project.conf
Created November 30, 2015 10:26 — forked from wicochandra/nginx-project.conf
My default server configuration for development.
server {
listen 80;
listen 8888;
server_name localhost;
index index.php index.html index.htm;
root /path/to/root;
autoindex on;
@mrofi
mrofi / AdminLTE.min.css
Last active September 29, 2015 16:53
Admin LTE Skin - Yellow v2
@import url(google-fonts.css);
/*@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic);*/
/*!
* AdminLTE v2.3.0
* Author: Almsaeed Studio
* Website: Almsaeed Studio <http://almsaeedstudio.com>
* License: Open source - MIT
* Please visit http://opensource.org/licenses/MIT for more information
!*/html,body{min-height:100%}.layout-boxed html,.layout-boxed body{height:100%}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:400;overflow-x:hidden;overflow-y:auto}.wrapper{min-height:100%;position:static;overflow:hidden}.wrapper:before,.wrapper:after{content:" ";display:table}.wrapper:after{clear:both}.layout-boxed .wrapper{max-width:1250px;margin:0 auto;min-height:100%;box-shadow:0 0 8px rgba(0,0,0,0.5);position:relative}.layout-boxed{background:url('../img/boxed-bg.jpg') repeat fixed}.content-wrapper,.right-side,.main-footer{-
@mrofi
mrofi / README.md
Last active September 7, 2015 00:23 — forked from mul14/README.md
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 {
@mrofi
mrofi / validation.php
Last active November 21, 2022 08:02 — forked from RoesWibowo/validation.php
Laravel 4 Validation Message Bahasa Indonesia
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
@mrofi
mrofi / exec.php
Created May 26, 2015 01:25
This will execute $cmd in the background (no cmd window) without PHP waiting for it to finish, on both Windows and Unix.
<?php
function execInBackground($cmd) {
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}
?>
@mrofi
mrofi / stringTransform.js
Last active August 29, 2015 14:19
case in string
// convert space to undersocre (snake case)
string.toLowerCase().split(' ').join('_');
// convert underscore to space
string.split('_').join(' ');
// camelize
function camelize(str) {
return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
@mrofi
mrofi / ngAutoGrow.js
Last active August 29, 2015 14:19
Autogrow Textarea with AngularJS
// MIT Licence (MIT)
// Copyright (c) 2015 - Mokhamad Rofiudin
// inspired by Facebook Textarea
// Based on code here https://gist.github.com/thomseddon/4703968
// The Magic Sauce : http://stackoverflow.com/a/3238543/4711810
// How to use : <textarea auto-grow></textarea>
// For jQuery visit here : https://gist.github.com/mrofi/a5c6bc25539eacf1750b
app.directive('autoGrow', function() {