Skip to content

Instantly share code, notes, and snippets.

View spjoshis's full-sized avatar
🎯
Focusing

Gopal Joshi spjoshis

🎯
Focusing
View GitHub Profile

Converts a comma-separated values (CSV) string to a 2D array of objects. The first row of the string is used as the title row.

const CSVToJSON = (data, delimiter = ',') => {
  const titles = data.slice(0, data.indexOf('\n')).split(delimiter);
  return data
    .slice(data.indexOf('\n') + 1)
    .split('\n')
 .map(v => {
@niksumeiko
niksumeiko / git.migrate
Last active June 28, 2024 21:01
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.