Skip to content

Instantly share code, notes, and snippets.

View cyberfly's full-sized avatar

Muhammad Fathur Rahman cyberfly

View GitHub Profile
@raoulbia-ai
raoulbia-ai / claude-flow-codespace-setup-guide.md
Last active December 31, 2025 06:50
Complete setup guide for Claude-Flow AI agent swarms in GitHub Codespaces. Includes universal dev container config for Docker/Kubernetes/Codespaces, authentication workflow, and community-tested troubleshooting. Based on AI Code Chat community discussions.

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
@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active September 22, 2025 11:02
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?

@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'],
@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)
@brunogaspar
brunogaspar / macro.md
Last active December 29, 2025 23:35
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

@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>
@cyberfly
cyberfly / CheckRequestPermission.php
Last active November 28, 2017 06:40
Form Request trait for route validation and role permission
<?php namespace App\Traits;
use App\MeetingApprovalCommittee;
use App\Role;
trait CheckRequestPermission {
/**
* Check role permission to form request class to be validated
*
@NishiGaba
NishiGaba / iterate-over-array.js
Last active November 29, 2023 10:27
8 Methods to Iterate through Array
//8 Methods to Iterate through Array
//forEach (Do Operation for Each Item in the Array)
[1,2,3].forEach(function(item,index) {
console.log('item:',item,'index:',index);
});
//map (Translate/Map all Elements in an Array to Another Set of Values.)
const oneArray = [1,2,3];
const doubledArray = oneArray.map(function(item) {
@cyberfly
cyberfly / gittips.txt
Created May 24, 2017 01:56
How do I resolve git saying “Commit your changes or stash them before you can merge”? https://stackoverflow.com/a/15745424/417899
You can't merge with local modifications. Git protects you from losing potentially important changes.
You have three options.
1. Commit the change using
git commit -m "My message"
2. Stash it.
Stashing acts as a stack, where you can push changes, and you pop them in reverse order.