Skip to content

Instantly share code, notes, and snippets.

View Nosfheratu's full-sized avatar
🏠
Working from home

Fernando Serapio Nosfheratu

🏠
Working from home
View GitHub Profile
@Nosfheratu
Nosfheratu / NHibernateRepository.cs
Last active December 10, 2015 12:38
Generic repository pattern implementation for NHibernate
public interface IRepository<T>
{
IEnumerable<T> GetAll();
T GetByID(int id);
T GetByID(Guid key);
void Save(T entity);
void Delete(T entity);
}
public class Repository<T> : IRepository<T>
@Nosfheratu
Nosfheratu / Gemfile
Last active December 11, 2015 08:19
Creating a simple User model with secure password and image profile (gravatar)
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
@Nosfheratu
Nosfheratu / gist:4572534
Created January 19, 2013 12:54
Highlights active url .nav classes matching current url path
$(document).ready(function(){
if(location.pathname != "/"){
$('.nav li a[href^="/' + location.pathname.split("/")[1] + '"]').parent().addClass('active');
}
else
$('.nav li a:eq(0)').parent().addClass('active');
});
@Nosfheratu
Nosfheratu / setup.md
Last active December 15, 2015 01:49 — forked from georgeredinger/setup.md

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev

/* Requirements install git and curl */
/* installing rbenv */
curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
/* add this instead of generated stuff "PREPEND" the echo wordings to ~/.profile */
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
#Junk Files
*.DS_Store
[Tt]humbs.db
#Visual Studio Files
[Oo]bj
[Bb]in
[Dd]ebug
[Bb]uild/
*.user
@Nosfheratu
Nosfheratu / RefineryCMS
Last active December 21, 2015 23:38
This is a step-by-step guide to install and deploy a Refinery CMS application on Heroku
==Configuration==
Ubuntu 12.04 LTS, precise
ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
Rails 3.2.13
--Prerequisites
***I have a Vagrant for my development environment (avoid this, this is transparent for you...)
@Nosfheratu
Nosfheratu / Override RefineryCMS
Last active December 22, 2015 06:38
Everything you can override in a refinerycms project with refinerycms-blog
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
@Nosfheratu
Nosfheratu / _disqus.html.haml
Created September 4, 2013 09:36
Disqus up and running on Rails
#disqus_thread
:javascript
// put the short name you signed up with here
var disqus_shortname = 'example';
var disqus_developer = #{ Rails.env == "production" ? '0' : '1' };
var disqus_title = "#{ title }";
var disqus_url = "#{ request.url }";
var disqus_identifier = "#{ request.fullpath }";
(function() {
var dsq = document.createElement('script');
@Nosfheratu
Nosfheratu / ruby-trick-trips
Created September 8, 2013 18:10
Usefull Ruby code snippets
# capitalize each word of a string
'some string'.split(' ').map {|w| w.capitalize }.join(' ')