Skip to content

Instantly share code, notes, and snippets.

@rafops
rafops / sti_with_type_table.rb
Created September 16, 2015 21:48
Rails STI with type table
class ItemType < ActiveRecord::Base
validates :title, presence: true, uniqueness: true
validates :class_name :presence: true, uniqueness: true
end
class Item < ActiveRecord::Base
belongs_to :item_type, foreign_key: :type, primary_key: :class_name
end
<div id="taboola-grid-2x2-side" class="taboola-sidebar" style="width:300px; height: 540px; display:none;"></div>
<script>
window._taboola = window._taboola || [];
if(document.URL.match('/$') || document.URL.match('/canal/')) {
$("#taboola-grid-2x2-side").show();
_taboola.push({ mode: 'grid-2x2', container: 'taboola-grid-2x2-side' });
}
</script>
<div id="taboola-grid-2x2" class="taboola-sidebar" style="width:300px; height: 540px; display:none;"></div>
<script type="text/javascript">
window._taboola = window._taboola || [];
if(document.URL.match('/$') || document.URL.match('/canal/')) {
$("div.taboola-sidebar").show();
_taboola.push({ mode: 'grid-2x2', container: 'taboola-grid-2x2' });
}
</script>
<div id="taboola-grid-2x2" style="width:620px; height: 280px; display: none;"></div>
<script type="text/javascript">
window._taboola = window._taboola || [];
if(document.URL.match('/noticia/') && !document.URL.match('/videos-ge')) {
$("#taboola-grid-2x2").show();
_taboola.push({ mode: 'grid-2x2', container: 'taboola-grid-2x2' });
}
</script>
<div id="taboola-grid-2x2" style="width:620px; height: 280px; display: none;"></div>
<script type="text/javascript">
window._taboola = window._taboola || [];
if(document.URL.match('/noticia/') && !document.URL.match('/videos-ge')) {
$("#taboola-grid-2x2").show();
_taboola.push({ mode: 'grid-2x2', container: 'taboola-grid-2x2' });
}
</script>
<div id="taboola-grid-2x2" class="taboola-sidebar" style="width:300px; height: 540px; display:none;"></div>
<script type="text/javascript">
window._taboola = window._taboola || [];
if(document.URL.match('/$') || document.URL.match('/canal/')) {
$("div.taboola-sidebar").show();
_taboola.push({ mode: 'grid-2x2', container: 'taboola-grid-2x2' });
}
</script>
@rafops
rafops / svn_to_git.txt
Created September 25, 2012 16:18
SVN to Git
apt-get install git-svn
git svn clone http://my.svn.server/myproject
cd myproject
git remote add origin http://my.git.server/myproject.git
git push origin master
@rafops
rafops / find_exec.txt
Created September 24, 2012 13:32
Find and execute
find . -exec $command {} \;
@rafops
rafops / installing_ruby.txt
Created September 23, 2012 11:43
installing ruby
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar zxvf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure --prefix=$HOME/.rbenv/versions/1.9.3-p194
@rafops
rafops / restart_nfs.txt
Created September 20, 2012 12:09
Restart NFS
service nfs stop
service portmap stop
service portmap start
service nfs start
service nfs stop && service portmap stop && service portmap start && service nfs start