Skip to content

Instantly share code, notes, and snippets.

View royts's full-sized avatar

Roy Tsabari royts

View GitHub Profile

Squashing commits the easy way

Rewriting history is only safe if no one depends on your branch.

So for example never do this on parent branches ie: develop, master, a feature branch with child branches, etc.

Example workflow:

  1. Make feature branch
  2. Haxxor
  3. Push to origin (optional but your dentist recommends you floss)
  4. Repeat steps 2 - 3 as necessary
  5. Squash commits using the function in this article
@revolunet
revolunet / python-es6-comparison.md
Last active April 22, 2024 19:22
# Python VS JavaScript ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math
@danharper
danharper / 1-sleep-es7.js
Created February 8, 2015 16:55
ES7's async/await syntax.
// ES7, async/await
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
(async () => {
console.log('a');
await sleep(1000);
console.log('b');
})()
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@spiralman
spiralman / bdd.py
Created April 7, 2013 18:35
Mocha inspired, BDD style testing for Python, using decorators.
import unittest
import collections
tests = collections.defaultdict(list)
class BddLoader(object):
def loadTestsFromModule(self, module):
return unittest.TestSuite(tests[module.__name__])
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 28, 2024 14:54
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname