Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
chris-ramon / git.sh
Last active November 24, 2023 19:17
git notes
# undo last commit, keep changes
git reset --mixed HEAD~1
# git log by directory
git log --oneline -n 10 -- dir_name/
# ammend git commit message
git rebase -i parent-commit-hash
# replace pick with reword, then update the commit message.
@chris-ramon
chris-ramon / gist:3948985
Created October 24, 2012 21:24
INTELLI J SHORTCUTS
### Collapse Current Code Block
ctrl + +
### Reduce Current Code Block
ctrl + -
### Display the hierarchy of the current class
ctrl + h
### Got to class
@chris-ramon
chris-ramon / tw.css
Created October 26, 2012 23:53
fix twitter bootstrap white colors on sidebar navs.
/* fix twitter boostrap for <ul class='nav-tabs'> white color icons bug */
.nav > .active > a > [class^="icon-"],
.nav > .active > a > [class*=" icon-"] {
background-image: url("../img/glyphicons-halflings.png");
}
/* END fix twitter boostrap for <ul class='nav-tabs'> white color icons bug */
@chris-ramon
chris-ramon / hiden-files.sh
Created October 28, 2012 19:44
show - hide, hidden file mac
# Display hidden files
>>> defaults write com.apple.Finder AppleShowAllFiles YES
# Restart finder
# Hide files
>>> defaults write com.apple.Finder AppleShowAllFiles NO
# Restart finder
@chris-ramon
chris-ramon / metaclasses.py
Created November 8, 2012 19:26
python metaclasses
class MyMetaClass(type):
def __new__(cls, future_class_name, future_class_parents, future_class_attr):
class_object = type(future_class_name, future_class_parents, future_class_attr)
class_object.foo = "bar"
return class_object
class MyAwesomeClass(object):
constant = 1
__metaclass__ = MyMetaClass
@chris-ramon
chris-ramon / gist:4051620
Created November 10, 2012 16:39
square selection my fav ides
# sublime text 2
cmd + option
# intelli j IDEA
shift + option
@chris-ramon
chris-ramon / Capistrano-Deployment-Recipe.rb
Created November 15, 2012 05:16 — forked from mrrooijen/Capistrano-Deployment-Recipe.rb
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@chris-ramon
chris-ramon / rails-production.sh
Created November 16, 2012 05:58
RAILS PRODUCTION COMNANDS
### LOG
tail -f log/production.log
@chris-ramon
chris-ramon / fixedcost.py
Created November 29, 2012 17:29
typecost fixedcost
from apps.rp.management.commands_helpers.insert import InsertHelperMixin
from apps.rp.models.FixedCost import FixedCost
class FixedCostHelper(InsertHelperMixin):
entity = FixedCost
objects_to_insert = [
{
'name' : 'teu 200',
'typecost' : 0,
'typevalue' : 1,
class InvoiceCreateView(LoginRequiredMixin, CreateView):
model = Invoice
form_class = InvoiceForm
template_name = 'panel/invoices/create.html'
def get_initial(self):
client = self.get_client()
return {'billing_address': client.address, "invoice_number" : self.get_invoice_number() }
def get_client(self):