Skip to content

Instantly share code, notes, and snippets.

View kritik's full-sized avatar

Vladimir Krylov kritik

  • PerfectLine
  • Tallinn, Estonia
View GitHub Profile
source :rubygems
# Specify the database driver as appropriate for your application (only one is necessary).
# Defaults to sqlite3. Don't remove any of these below in the core or gems won't install.
#gem 'sqlite3-ruby', :require => 'sqlite3' #db_adapter=sqlite3
gem 'mysql', :require => 'mysql'#, :db_adapter=>:mysql
# gem 'pg' #db_adapter=postgresql
# Specify your favourite web server (only one) - not required.
# gem 'unicorn', :group => :development
/home1/cyprusci/rails_apps/diamond/config/boot.rb:110: warning: method redefined; discarding old run
Exception `LoadError' at /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:1113 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at /usr/lib64/ruby/site_ruby/1.8/rubygems/config_file.rb:50 - no such file to load -- Win32API
Exception `LoadError' at /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- bundler
Exception `NoMethodError' at /usr/lib64/ruby/1.8/rational.rb:78 - undefined method `gcd' for Rational(1, 2):Rational
/home1/cyprusci/rails_apps/diamond/vendor/plugins/refinery/lib/refinery.rb:5: warning: method redefined; discarding old is_a_gem
/home1/cyprusci/rails_apps/diamond/vendor/plugins/refinery/lib/refinery.rb:9: warning: method redefined; discarding old root
/home1/cyprusci/rails_apps/diamond/vendor/plugins/refinery/lib/refinery.rb:13: warning: method redefined; discarding old s3_backend
/home1/cyprusci/rails_apps/diamond/vendor/plugins/r
# controller from http://diamond.cyprus-city.com/travels
class TravelsController < ApplicationController
before_filter :find_all_travels
before_filter :find_page
def index
# you can use meta fields from your model instead (e.g. browser_title)
# by swapping @page for @travel in the line below:
<?php
/**
* Hello Controller for Hello World Component
*
* @package VladimirKrylov
* @subpackage Components
* @license GNU/GPL
*/
// No direct access
@kritik
kritik / gist:1037898
Created June 21, 2011 13:54
Refinerycms-images preview test scenario
Scenario: Show preview textarea if prewiev is allowed
Given I have news items titled Home, About
And I have setting "Refinery News Show Preview" allowed
When I go follow "Home"
Then I should see "Preview text"
@kritik
kritik / gist:1256399
Created October 1, 2011 17:47 — forked from crosebrugh/gist:1128448
Using nested_form_for with rails_admin
class Product < ActiveRecord::Base
has_many :material_product_mappings, :dependent => :destroy, :inverse_of => :product
has_many :materials, :through => :material_product_mappings, :autosave => true
accepts_nested_attributes_for :material_product_mappings # really needed feature
#...
end
@kritik
kritik / schema.xml
Created November 4, 2011 19:31
tomcat-pruction solr config
<?xml version="1.0" encoding="UTF-8" ?>
<!-- from jetty-solr https://github.com/dcrec1/jetty-solr/blob/master/solr/conf/schema.xml -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
@kritik
kritik / gist:5196475
Created March 19, 2013 14:19
god config
# == God config file
# http://god.rubyforge.org/
# Author: Gump
#
# fixed thin ports <michael@glauche.de>
#
# Config file for god that configures watches for each instance of a thin server for
# each thin configuration file found in /etc/thin.
require 'yaml'
@kritik
kritik / gist:5204504
Created March 20, 2013 13:07
warRoom
Vladimirs-iMac:thewarroom_fantasy_feed vladimir$ bundle exec sidekiq start -C config/sidekiq.yml
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
Skipping index creation, cannot connect to Elasticsearch
(The original exception was: #<Errno::ECONNREFUSED: Connection refused - connect(2)>)
Instance method "true?" is already defined in Object, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.
/Users/vladimir/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
Skipping index creation, cannot connect to Elasticsearch
(The original exception was: #<Errno::ECONNREFUSED: Connection refused - connect(2)>)
Instance method "true?" is already defined in Object, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.
Skipping index creation, cannot connect to Elasticsearch
RubyProf.start
User.new({token: "$2a$10$Iii/rh4SAu4SN4bSz2d6kO0XRgny71iMFxQtArvwZuUhNcjigHW7S"}, true).find_photo(37)
result = RubyProf.stop
printer = RubyProf::FlatPrinter.new(result)
printer.print(STDOUT)
Thread ID: 70098585257680
Fiber ID: 70098618506940
Total: 0.139586
Sort by: self_time