Skip to content

Instantly share code, notes, and snippets.

Git Workflows: Duplicating Large Repositories Locally

Cloning large JavaScript repositories (like Telerik/Kendo) over the network is notoriously slow, and dealing with massive node_modules folders makes manual copying a nightmare. Here is a breakdown of the best ways to duplicate a local repo to work on separate branches simultaneously.

TL;DR: The Native Way (Git Worktree)

If you want to work on two different branches at the same time in separate VS Code windows without constantly switching or stashing, git worktree is the native tool built exactly for this. It takes zero seconds, takes up almost no extra disk space, and completely ignores node_modules.

How to do it:

  1. Open your terminal in your existing repository folder (e.g., kendo).
@pepinho24
pepinho24 / windows-symlinks-junctions-cheatsheet.md
Last active September 15, 2026 17:59
Windows File Links (Symlinks, Junctions, Hard links): The Ultimate Cheatsheet Guide
@pepinho24
pepinho24 / load-js-via-bookmark-click.js
Created August 22, 2019 14:01
This gist shows how to use the browser's bookmarks to add a script in the current page
javascript: void ((function () {
andiScript = document.createElement('script');
andiScript.setAttribute('src', 'https://code.jquery.com/jquery-3.4.1.min.js');
document.body.appendChild(andiScript)
})());
// Description: The following script is configured to load jQuery on the page.
// Simply by changing the value of the "src" attribute, you can load your own scipts
// Setup:
@pepinho24
pepinho24 / replaceAll.js
Created February 21, 2019 09:32
ReplaceAll function that replaces all occurrences using Regular Expressions
String.prototype.replaceAll = function replaceAll(find, replace) {
return this.replace(new RegExp(find, 'g'), replace);
}
// Example: "a sdsds a sdsd".replaceAll("a", "2")
// result: "2 sdsds 2 sdsd"
// Another option is to use it just as a function:
function replaceAll(str, find, replace) {
@pepinho24
pepinho24 / visible-console.html
Last active May 1, 2020 15:15
A custom log method that adds a message to a custom div, so that it is visible with no DevTools
<!-- Example
function myFunc(){
log("some message");
// some logic
log("some other message");
} -->
<style>
#console {
@pepinho24
pepinho24 / connectionstrings-cheatsheet.txt
Created January 21, 2019 09:44
Sample ConnectionStrings in web.config and how to access them with C#
// How to get Connection string with C#
var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString;
// Declare in web.config a ConnectionString to VisualStudio's LocalDB
<configuration>
<connectionStrings>
<add name="NorthwindConnectionString" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|Northwind.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
// Declare in web.config a ConnectionString to DB existing in SQL Server
@pepinho24
pepinho24 / Check-currently-active-element.js
Created December 20, 2018 15:48
Check the currently active DOM element, similar to adding document.activeElement in the Google Chrome's live expression
// Check the currently active DOM element, similar to adding document.activeElement in the Google Chrome's live expression
// Chrome DevTools live expression docs: https://developers.google.com/web/updates/2018/08/devtools#watch
var currentActiveElement = document.activeElement;
console.log(currentActiveElement);
var interval = setInterval(function(){
if(document.activeElement != currentActiveElement){
currentActiveElement = document.activeElement;
console.log(currentActiveElement);
}
@pepinho24
pepinho24 / JavaScript-StringFormat.js
Created December 12, 2018 12:55
C# string.Format() alternative for JavaScript
// https://stackoverflow.com/a/4256130/10759760
String.prototype.format = function () {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
var regexp = new RegExp('\\{' + i + '\\}', 'gi');
formatted = formatted.replace(regexp, arguments[i]);
}
return formatted;
};
// Sample usage:
@pepinho24
pepinho24 / remove-new-line-VS.txt
Created October 29, 2018 13:18
Remove empty new lines in Visual Studio
1. Open a file in Visual Studio
2. Press ctrl+H(shortcut for Find and replace)
3. Enable regex
4. Use the following expression ^\s*$\n and replace it with an empty string
@pepinho24
pepinho24 / Programmatic-Hierarchical-DataTable-Creation.cs
Created September 27, 2018 07:58
Create a Hierarchical DataTable with dummy data by only passing number of nodes per level
// Example how to use in RadTreeView and RadOrgChart at the end of file
private DataTable CreateHierarchicalDataTable(int[] nodesPerLevel)
{
var dataTable = new DataTable();
dataTable.Columns.Add("ID");
dataTable.Columns.Add("ParentID");
dataTable.Columns.Add("Text");
dataTable.Columns.Add("Collapsed");