Skip to content

Instantly share code, notes, and snippets.

View edgar's full-sized avatar

Edgar Gonzalez edgar

View GitHub Profile
class Stream
include Mongoid::Document
include Mongoid::Timestamps
field :original_photo_id
field :locked, type: Boolean, default: false
field :popular, type: Boolean, default: false
field :popular_order
field :photos_count
field :title
class Photo
include Mongoid::Document
include Mongoid::Timestamps
referenced_in :stream
set_callback(:destroy, :after) do |document|
document.update_stream
end
def update_stream
@edgar
edgar / git_svn_bash_prompt
Created August 22, 2011 14:46
Set the bash prompt according to: branch/status of the current git/svn repository, rvm/ruby version and gemset used
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git/svn repository
# * the return value of the previous command
# * the current rvm ruby version and gemset (or plain ruby, check parse_ruby_version function)
#
# USAGE:
@edgar
edgar / git_svn_bash_prompt.sh
Created October 31, 2010 22:55 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to ruby version and git/svn branch, and return status of last command
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the ruby version
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#