Skip to content

Instantly share code, notes, and snippets.

View Tiagojdferreira's full-sized avatar

Tiago Ferreira Tiagojdferreira

View GitHub Profile
@Tiagojdferreira
Tiagojdferreira / safe.md
Created June 5, 2018 08:09 — forked from bryanrite/safe.md
Safe Postgres Operations on High Volume Tables

Originally taken from: Braintree Article and expanded on by me.

Safe

  • Add a new column
  • Drop a column
  • Rename a column
  • Add an index concurrently (Example), Note: it will still take a long time to run the migration, but it won't write-lock the table.
  • Drop a constraint (for example, non-nullable)
  • Add a default value to an existing column
docker exec -it --user root <bucket> /bin/bash
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# General clean up commands.
```
find . -type f -empty -delete
git fsck --full
git gc --aggressive --prune=now
```
# Dealing with bad ref head
@Tiagojdferreira
Tiagojdferreira / merge.md
Created March 31, 2017 14:50 — forked from jt/merge.md
Merge a forked gist

If someone forks a gist and you'd like to merge their changes. Do this:

  1. clone your repo, I use the name of the gist

     git clone git://gist.github.com/1163142.git gist-1163142
    
  2. add a remote for the forked gist, I'm using the name of my fellow developer

     git remote add aaron git://gist.github.com/1164196.git
    
@Tiagojdferreira
Tiagojdferreira / README.md
Last active February 13, 2020 01:00 — forked from marchelbling/README.md
git hooks

Git hooks for better pivotal integration:

  • pre-commit:
    • prevents commiting on a branch that is not suffixed by an issue number. Some special branches (develop, master) and hotfixes are not constrained
    • lints modified python files and exits upon non correctly formatted modules
    • other formats (js, scss) have pending code that is not currently called as the workflow for front code is not clear
  • prepare-commit-msg: prepend issue number to commit message if it's missing and if it is set in the branch name (see pre-commit hook)
  • post-checkout: [optional] automatically update submodules when checkouting a branch (requires to define the AUTO_SUBMODULE_UPDATE environment variable)

For easy setup:

@Tiagojdferreira
Tiagojdferreira / .gitconfig
Last active July 6, 2021 10:59
My gitconfig
[user]
name = Firstname Lastname
email = username@myEmail.com
[alias]
co = checkout
cot = "!f() { git branch | grep $1 | xargs -I {} git co {}; }; f"
b = branch
pu = push -u origin HEAD
ci = commit
st = status
@Tiagojdferreira
Tiagojdferreira / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="35" height="20" tilewidth="32" tileheight="32">
<tileset firstgid="1" name="area01_level_tiles" tilewidth="32" tileheight="32">
<image source="../img/map/area01_level_tiles.png" width="640" height="241"/>
</tileset>
<tileset firstgid="141" name="asterion" tilewidth="32" tileheight="32">
<image source="../img/map/asterion_level_tiles.png" width="640" height="241"/>
</tileset>
<imagelayer name="bkg0">
<image source="../img/area01_bkg0.png"/>
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="35" height="20" tilewidth="32" tileheight="32">
<tileset firstgid="1" name="asterion_level_tiles" tilewidth="32" tileheight="32">
<image source="../img/map/asterion_level_tiles.png" width="640" height="241"/>
</tileset>
<tileset firstgid="141" name="area01_level_tiles" tilewidth="32" tileheight="32">
<image source="../img/map/area01_level_tiles.png" width="640" height="241"/>
</tileset>
<layer name="Background" width="35" height="20">
<data encoding="base64">