Skip to content

Instantly share code, notes, and snippets.

💭
alhamdulillah nice

Irnovi Albaweny huiralb

View GitHub Profile
@huiralb
huiralb / AppServiceProvider.php
Created Sep 22, 2017
Laravel 5.x : register services via service provider
View AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
@huiralb
huiralb / composer_view.js
Created Oct 2, 2016
Fix Visual Composer 4.8 Uncaught TypeError: Cannot read property 'attributes' of undefined
View composer_view.js
html2element: function(html) {
var $template, attributes = {},
template = html;
$template = $(template(this.model.toJSON()).trim());
if($template.get(0))
{
_.each($template.get(0).attributes, function(attr) {
attributes[attr.name] = attr.value
})};
@huiralb
huiralb / transponse.js
Last active May 14, 2016
Transpose Array
View transponse.js
// transpose it
// @param Array values Array multidimension one row
// @Result Array
function transpose(values){
return Object.keys(values[0]).map( function (columnNumber) {
return values.map( function (row) {
return row[columnNumber];
});
});
@huiralb
huiralb / AuthController.php
Last active Mar 27, 2016
Mencegah auth login setelah registration Laravel 5.2
View AuthController.php
<?php
// FOCUS pada fungsi register()
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
@huiralb
huiralb / CatalogController.php
Created Mar 16, 2016
Eloquent Order by Field
View CatalogController.php
<?php
class CatalogController extends Controller
{
public function catalogLists()
{
$subcatids = implode(',', $this->subcategoryIds());
$subcategories = \App\Subcategory::whereIn('subcatid', $this->subcategoryIds())
->orderByRaw("FIELD(subcatid, $subcatids)")
->get();
@huiralb
huiralb / Kernel.php
Created Mar 15, 2016
Laravel Language ( Localization )
View Kernel.php
<?php
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\LanguageMiddleware::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
@huiralb
huiralb / bs3ready.html
Last active Aug 29, 2015
HTML:starting bootstrap 3 template
View bs3ready.html
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>huiralb | home</title>
<!-- Bootstrap CSS -->
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
You can’t perform that action at this time.