Skip to content

Instantly share code, notes, and snippets.

View cyberfly's full-sized avatar

Muhammad Fathur Rahman cyberfly

View GitHub Profile
@Konafets
Konafets / EditInlineTemplate.blade.php
Last active January 22, 2019 08:28
VueJS Inline Template in Blade
<my-component inline-template>
<h1>@lang('users.edit') {{ $user->name }}</h1>
<form method="post" action="{{ route('users.update', ['user' => $user]) }}">
{!! csrf_field() !!}
<input name="_method" type="hidden" value="PATCH">
<!-- Some form fields -->
<button type="submit">{{ __('button.update') }}</button>
</form>
@brunogaspar
brunogaspar / macro.md
Last active November 25, 2024 11:01
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@meSingh
meSingh / JsonMiddleware.php
Last active July 11, 2022 09:19
If you are using laravel as api only, you might want to return JSON on every request, even on errors/exceptions. The easiest way to do so is using this middleware globally.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class JsonMiddleware
{
public function handle(Request $request, Closure $next)
@psychonetic
psychonetic / CustomVeeValidator
Last active April 4, 2020 07:02
Vue-Dropzone and Vee-Validate
// Custom Validator to add errors into vuex store and also handle laravel form errors.
import { mapGetters } from 'vuex';
import { CLEAR_FORM_ERRORS, ERROR } from '../vuex/types';
import Vue from 'vue';
export default {
data() {
return {
errors: [],
keepServerErrors: ['unique', 'boolean', 'exists', 'regular_chars', 'identifier', 'date'],
@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active May 13, 2025 21:24
Beginner Friendly: Using Multiple SSH keys

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?

How to deploy a Rails 7.1 app with Postgres and Kamal on a single server

I think you have looked at the tutorial from Mr. Heinemeier Hansson at least once or twice and have a similar setup.

rails new kamal_pg --css tailwind --skip-test --database=postgresql

cd kamal_pg