Skip to content

Instantly share code, notes, and snippets.

@msrose
msrose / combining-git-repositories.md
Last active November 5, 2024 10:15
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active July 24, 2024 14:27
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@Jerry0022
Jerry0022 / PHP Google oAuth2.php
Last active February 27, 2021 22:37
Google oAuth2, sign up, sign in, logout and show user data. Need to set REDIRECT_URL from google developer console and the https://github.com/google/google-api-php-client cloned in the web directory.
<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
$google_redirect_url = 'REDIRECT_URL';
//start session
session_start();
@nasrulhazim
nasrulhazim / 01.md
Last active October 23, 2023 07:19
Laravel Default API Login

Setup

Migration

Create new migration script:

php artisan make:migration add_api_token --table=users
@ollietreend
ollietreend / acf-php-to-json.php
Last active September 18, 2024 05:24
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@abstractart
abstractart / books.md
Last active June 18, 2024 16:10
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
@kamenarov
kamenarov / mikrotik-vpn.md
Last active February 28, 2022 10:34
Mikrotik VPN / Specific websites and devices / AdBlocker / RouterOS v7

Info: My network IP addresses are in range: 10.0.0.0 - 10.0.0.256

Add VPN

No description here

For example I'm using as a name NameVPN for the VPN connection

#Add Route table Routing>Tables>Add New