Skip to content

Instantly share code, notes, and snippets.

View ugisozols's full-sized avatar

Uģis Ozols ugisozols

View GitHub Profile
@ugisozols
ugisozols / gist:5983776
Last active December 19, 2015 16:29
DRAFT! Refinery CMS 2.1.0 upgrade guide

Upgrading from version 2.0.10 to version 2.1.x

This guide will guide you through the upgrade process from version 2.0.10 to version 2.1.×.

endprologue.

WARNING. This guide assumes that you will be upgrading from version 2.0.10 of Refinery CMS. If your application is not up-to-date we strongly recommend for you to upgrade it to version 2.0.10 before trying to upgrade to version 2.1.0.

WARNING. Before continuing make sure you have a backup copy of your application and database in case something goes wrong.

@ugisozols
ugisozols / gist:5955777
Last active December 19, 2015 12:38
Refinery::Pages::MenuPresenter guide draft

Additional menus

This guide will show you how to:

  • configure and use Refinery::Pages::MenuPresenter
  • use a decorator to add custom method to Refinery::Page class

endprologue.

Background

@ugisozols
ugisozols / gist:5917814
Created July 3, 2013 13:23
Middleware which speeds up Rails dev for apps with lots of assets
# turbo dev by Sam Saffron
# http://discuss.emberjs.com/t/what-are-people-doing-about-the-gazzillion-file-problem/1006/8
module Middleware
# this class cheats and bypasses rails altogether if the client attempts
# to download a static asset
class TurboDev
def initialize(app, settings={})
@app = app
end
# app/decorators/engine/refinery/i18n_decorator.rb
Refinery::I18n.module_eval do
built_in_locales.merge! :az => "Azerbaijan"
end
# run this once
git remote add refinery git://github.com/refinery/refinerycms.git
# run this every time you want to do a rebase from remote
git pull --rebase origin refinery master
@ugisozols
ugisozols / gist:5691647
Last active December 17, 2015 23:48
Adding back :meta_keywords to SeoMeta
# without https://github.com/refinery/refinerycms/pull/2285
# config/initializers/seo_meta_addon.rb
SeoMeta.class_eval do
attributes.merge! :meta_keywords => :string
end
Refinery::Page.class_eval do
attr_accessible :meta_keywords
end
<section>
<h1>About Me</h1>
<p class="profile-picture">
<img src="/images/ugisozols.png">
</p>
<p>
Hello there! My name is Uģis Ozols and I'm a self taught Ruby/Ruby on Rails developer but lately I've caught myself flirting with JavaScript more and more.
</p>
<p>
I've been learning to code on my own since late 2009 and I'm still finding it to be the best way to spend my spare time.
@ugisozols
ugisozols / gist:4132588
Created November 22, 2012 19:14
Don't depend on Rails' delegate
diff --git a/core/lib/refinery/plugins.rb b/core/lib/refinery/plugins.rb
index 7f7efea..869286a 100644
--- a/core/lib/refinery/plugins.rb
+++ b/core/lib/refinery/plugins.rb
@@ -1,11 +1,16 @@
+require 'forwardable'
+
module Refinery
class Plugins
include Enumerable
@ugisozols
ugisozols / gist:4125166
Created November 21, 2012 14:43
Stop subclassing array
diff --git a/core/lib/refinery/plugins.rb b/core/lib/refinery/plugins.rb
index a22497f..1d8e4ee 100644
--- a/core/lib/refinery/plugins.rb
+++ b/core/lib/refinery/plugins.rb
@@ -1,5 +1,10 @@
module Refinery
- class Plugins < Array
+ class Plugins
+ include Enumerable
+
@ugisozols
ugisozols / page.rb
Created November 14, 2012 12:11
Refinery::Pages::Url
# app/models/refinery/page.rb
# ... code ...
def url
@url ||= Refinery::Pages::Url.build(self)
end
def uncached_nested_url
[parent.try(:uncached_nested_url), to_param.to_s].compact.flatten