Skip to content

Instantly share code, notes, and snippets.

Tiago Ferreira Tiagojdferreira

Block or report user

Report or block Tiagojdferreira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Tiagojdferreira
Tiagojdferreira / safe.md
Created Jun 5, 2018 — forked from bryanrite/safe.md
Safe Postgres Operations on High Volume Tables
View safe.md

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
View init.coffee
# 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 ->
View Stephanes magic git commands
find . -type f -empty -delete
git fsck --full
git gc --aggressive --prune=now
# Dealing with bad ref head
tail .git/logs/HEAD # from http://git.661346.n2.nabble.com/corrupted-Git-repository-td6498902.html
git update-ref HEAD <hash> # from https://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty
@Tiagojdferreira
Tiagojdferreira / merge.md
Created Mar 31, 2017 — forked from jt/merge.md
Merge a forked gist
View merge.md

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
    
View README.md

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:

View .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 Aug 29, 2015
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 area01_old.tmx
<?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"/>
View area01.tmx
<?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">
You can’t perform that action at this time.