Skip to content

Instantly share code, notes, and snippets.

Avatar

Lautaro Gruss lautapercuspain

View GitHub Profile
@lautapercuspain
lautapercuspain / git-clearHistory
Created Jun 20, 2021 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@lautapercuspain
lautapercuspain / repo-reset.md
Created Jun 20, 2021 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands
View repo-reset.md

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@lautapercuspain
lautapercuspain / store.js
Created Jan 13, 2021
No More Redux Por Favor
View store.js
// store.js
import React, {createContext, useReducer} from 'react';
const initialState = {};
const store = createContext(initialState);
const { Provider } = store;
const StateProvider = ( { children } ) => {
const [state, dispatch] = useReducer((state, action) => {
switch(action.type) {
View gist:4f633e9d39d884bd238a714bb839956d
$stderr.write 'Press enter to continue'
$stdin.gets
@lautapercuspain
lautapercuspain / terminal-git-branch-name.md
Created Nov 22, 2019 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)
View terminal-git-branch-name.md

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@lautapercuspain
lautapercuspain / 0_reuse_code.js
Created Feb 10, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:4f0ff248e21729c386ef
_ __(_)___ ____ ___ __(_)____/ /_______/ /_____ ______/ /_
| | / / / __ \ / __ `/ / / / / ___/ //_/ ___/ __/ __ `/ ___/ __/
| |/ / / /_/ / / /_/ / /_/ / / /__/ ,< (__ ) /_/ /_/ / / / /_
|___/_/ .___/ \__, /\__,_/_/\___/_/|_/____/\__/\__,_/_/ \__/
/_/ /_/
==================================
@lautapercuspain
lautapercuspain / layout.html.erb
Created Aug 24, 2012 — forked from joho/layout.html.erb
Doing custom facebook JS api stuff while loading their API async (from the layout).
View layout.html.erb
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR_APP_ID', // App ID
status : true, // check login status
});
// check if the view has registered an "after facebook load callback"
if(typeof window.appSpecificFbAsyncInit == 'function') {