Skip to content

Instantly share code, notes, and snippets.

View blueyed's full-sized avatar
💭
❤️ not eating nor abusing animals 🍀

Daniel Hahler blueyed

💭
❤️ not eating nor abusing animals 🍀
View GitHub Profile
# bash/zsh git prompt support
# # -*- encoding: utf-8 -*-
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@christoomey
christoomey / gist:759231
Created December 29, 2010 23:44
Git aware command T functions. Use git repo top level as Command T context, else top level
function! Command_T_Local() "Go to the root of the git repo, then CommandT
"Ask git for the root of the git repo (as a relative '../../' path)
let git_top = system('git rev-parse --show-cdup')
let git_fail = 'fatal: Not a git repository'
if strpart(git_top, 0, strlen(git_fail)) == git_fail
" Above line says we are not in git repo. Ugly. Better version?
call Command_T_Work()
else
" Move working dir to root of repo, then CommandT
execute ":cd ./" . git_top
@juanpabloaj
juanpabloaj / nextBufOrTab.vim
Created October 14, 2011 17:43
gt next buffer or tab
" http://j.mp/dotvimrc
nn gt : exec tabpagenr('$') == 1 ? 'bn' : 'tabnext'<CR>
nn gT : exec tabpagenr('$') == 1 ? 'bp' : 'tabprevious'<CR>
@studgeek
studgeek / Heroku tracking branch.txt
Created March 8, 2012 16:55 — forked from seangeo/Heroku tracking branch.txt
Create a local tracking branch of your heroku/phpfog deployment
Create remote called heroku
> git remote add heroku git@heroku.com:YOURAPPNAME.git
create a local tracking branch called heroku
> git checkout -b heroku -t heroku/master
This will checkout the last revision you deployed to Heroku.
Now tell git to push the heroku branch to heroku/master
@AndrewRadev
AndrewRadev / mappings.vim
Created December 8, 2012 10:35
Star ("*") mapping that tries to be a bit smarter
" Using "g*" does two things differently from the normal "*":
"
" - Doesn't move the cursor, simply sets the match
" - When moving the cursor with "n" and "N", positions it where it was on the original word.
"
" Note: g* is ordinarily taken, see :help g*
"
nnoremap g* :call <SID>SmartStar()<cr>
function! s:SmartStar()
@tarruda
tarruda / .ycm_extra_conf.py
Created January 16, 2014 17:48
YouCompleteMe configuration for vim source code (.ycm_extra_conf.py)
# .ycm_extra_conf.py for vim source code. This should work after running './configure
import os, re
def create_flags():
rv = [
'-Wall',
'-Wextra',
'-std=c89',
'-x',
@akkartik
akkartik / ondemandhighlight.vim
Last active January 4, 2016 15:39
Highlight a word from inside vim. The color is chosen at random but persisted across sessions.
" Highlight a word from inside vim. The color is chosen at random but
" persisted across sessions.
" By Kartik Agaram -- http://akkartik.name -- ondemandhighlight@akkartik.com
" Experimenting with an idea by Evan Brooks: https://medium.com/p/3a6db2743a1e
" Discussion: http://www.reddit.com/r/programming/comments/1w76um/coding_in_color
let highlight_file = &viewdir."/highlights"
if !filereadable(highlight_file)
call system("mkdir -p ".&viewdir)
@magopian
magopian / conftest.py
Created November 27, 2013 10:46
Little hack for pytest_django: load data in your test database before the tests are run, only if the database is being created and not reused.
import pytest
@pytest.fixture(scope='session')
def _django_db_setup(request, _django_db_setup, _django_cursor_wrapper):
"""Load any data needed for the tests after the database is created.
This "overwrites" pytest_django's own _django_db_setup.
"""
@chekunkov
chekunkov / pythonstartup.py
Last active January 19, 2017 00:25
PYTHONSTARTUP file example with custom displayhook
#!/usr/bin/env python
import sys
import pprint
def displayhook_pprint(o):
"""Display hook powered by pprint.
https://www.python.org/dev/peps/pep-0217/
@davidfraser
davidfraser / venv_link.py
Last active June 2, 2017 20:30
Script to link Python system package into virtual environment from Nick Coghlan at https://bitbucket.org/ncoghlan/misc/raw/44341af0b2e4ac7f9580d5f907d8f49c7013b3b9/venv_link.py Modified to use system python to find the module, and pip to decide the link location