Skip to content

Instantly share code, notes, and snippets.

@ecomba
ecomba / freedom.sh
Created July 1, 2020 10:12
Little tool that helps you moving away from 'master' as your default branch (and deletes master in the process)
#!/bin/bash
function pause(){
read -p "$*"
}
echo "This script will help you rename your default branch (master) to"
echo "a name of your choosing."
echo ""
echo "Let's rebase your local repository with your origin first"
echo ""
git fetch origin

Keybase proof

I hereby claim:

  • I am ecomba on github.
  • I am ecomba (https://keybase.io/ecomba) on keybase.
  • I have a public key ASBWCpidiG4s9Zzx5IzPwgeG2qAXahMSnoDkFU71_K9JlAo

To claim this, I am signing this object:

@ecomba
ecomba / the_mob.bash
Created June 20, 2016 09:12
Mobbing with bash
function add_mobber() {
touch ~/.the_mob
echo $1:$2:$3 >> ~/.the_mob
}
function the_mob() {
echo $GIT_AUTHOR_NAME
}
function unmob() {
@ecomba
ecomba / hexagon.rb
Created July 11, 2013 14:10
A little gist showing how you could bind an app with an adapter to a web controller.
class Board
def add_ship ship
ship
end
def shoot(coordinates, player)
raise "Not your turn" if player == 2
'BANG'
end
end
class Board
def initialize ships
@ships = ships
end
def shoot coordinates
if coordinates == 1 # this would call the ships really
@ships = [0,0,-1,1]
return 'HIT'
end
show_project(named: 'Wunderlist', for: 'Chad')
def show_project(named: project_name, for: username,
user: user(for),
project: project(user, named))
Presenter::Board.new(project, user).render
end
def show_project(username, project_name,
user: user(username),
project: project(user, project_name))
Presenter::Board.new(project, user).render
end
def user username
User.with(username)
end
def show_project(username, project_name)
user = User.with(username)
project = Project.for(user).named(project_name)
Presenter::Board.new(project, user).render
end
def a_method(required_arguments, optional_arguments,
*additional_required_arguments,
keyword_arguments: "with_defaults",
**rest_of_keyword_arguments,
&block_capture)
end