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:6778058
Last active April 4, 2019 17:18
Refinery CMS + Dragonfly + Amazon S3 + Amazon Cloudfront
# config/environments/production.rb:
config.action_controller.asset_host = "http://cdn%d.example.com"
# config/initializers/refinery/images.rb:
config.dragonfly_url_format = "/images/:job/:basename.:ext"
if Rails.env.production?
config.dragonfly_url_host = "http://cdn4.example.com"
end
# config/initializers/refinery/resources.rb:
@ugisozols
ugisozols / application.rb
Created September 6, 2011 14:25
assets lazily compiled in production
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
# Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
Bundler.require(:default, :assets, Rails.env)
end
@ugisozols
ugisozols / nokogiri_install
Created July 23, 2018 12:05 — forked from sobstel/nokogiri_install
nokogiri -> ERROR: cannot discover where libxml2 is located on your system
# `ERROR: Error installing nokogiri:
# ERROR: Failed to build gem native extension.
#
# current directory: /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.7.0/ext/nokogiri
# /usr/local/var/rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170103-68488-r71c9j.rb extconf.rb --with-xml=/usr/local/Cellar/libxml2/ --use-system-libraries
# checking if the C compiler accepts ... yes
# checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
# Building nokogiri using system libraries.
# ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
# *** extconf.rb failed ***
@ugisozols
ugisozols / base_page.cr
Created November 11, 2017 21:35
no argument named 'user_names'
# src/pages/base_page.cr
abstract class BasePage
include LuckyWeb::HTMLPage
def render
html lang: "en" do
head do
utf8_charset
title page_title
css_link asset("css/app.css")
@ugisozols
ugisozols / gist:6805942
Last active April 18, 2017 09:26
Refinery CMS - updated MenuPresenter guide
h2. Additional Menus
This guide will show you how to:
* configure and use +Refinery::Pages::MenuPresenter+
* use a decorator to add custom functionality to +Refinery::Page+ class
* override Refinery's view
endprologue.
h3. Requirements
@ugisozols
ugisozols / gist:6948325
Created October 12, 2013 10:17
Specifying custom layout only for Refinery::Blog::Post part.
# app/decorators/controllers/refinery/blog/posts_controller_decorator.rb
Refinery::Blog::PostsController.class_eval do
layout "my_custom_layout"
end
App.Entry = DS.Model.extend({
title: DS.attr("string"),
content: DS.attr("string")
});
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
require "rspec"
class Grid
attr_reader :cells, :ships
SIZE = 10
def initialize
@cells = SIZE.times.map { [nil] * SIZE }
@ships = []
require "rspec"
class Grid
attr_reader :cells, :ships
SIZE = 10
def initialize
@cells = SIZE.times.map { [nil] * SIZE }
@ships = []