This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .redesign .title { | |
| margin-top: 0; | |
| margin-left: 0; | |
| } | |
| .redesign .segment { | |
| margin-bottom: 0; | |
| } | |
| .redesign .segment-content, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):010:0> class A; def dupa(x); x; end; end | |
| => nil | |
| irb(main):012:0> module Over; def dupa(x); x + 1; end; end | |
| => nil | |
| irb(main):013:0> A.new.dupa(1) | |
| => 1 | |
| irb(main):014:0> A.new.extend(Over).dupa(1) | |
| => 2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source "http://rubygems.org" | |
| gem "railties", '4.0.3', require: %w(action_controller rails) | |
| gem "grape" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get update | |
| # Install java | |
| sudo apt-get install openjdk-7-jre-headless wget curl -y | |
| # Install elasticsearch | |
| wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.3.deb | |
| sudo dpkg -i elasticsearch-1.0.3.deb | |
| sudo service elasticsearch start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module CachedDef | |
| def cached(name) | |
| meth = instance_method(name) | |
| raise ArgumentError.new("cached can be used only for method with no arguments") if meth.arity != 0 | |
| alias_method "__cached_def_original__#{name}", name | |
| class_eval <<-EOS | |
| def #{name} | |
| @__cached_def_cache__#{name} ||= __cached_def_original__#{name} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private def foo # make one method private | |
| instrumet def foo # calculates execution time | |
| silent def foo # silences stdout/err output | |
| cached def foo(args...) # caches each invokation with different arguments into redis | |
| memoize def foo # memoizes return value in instance variable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set number | |
| set nowrap | |
| set showbreak | |
| set textwidth=100 | |
| set showmatch | |
| set visualbell | |
| set hlsearch | |
| set smartcase | |
| set ignorecase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nobody ALL=(ALL) NOPASSWD:/usr/local/bin/passenger-status, /usr/local/bin/passenger-memory-stats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> Product.properties[:created_at].type | |
| => DateTime | |
| >> Product.properties[:deleted_at].type | |
| => DataMapper::Types::ParanoidDateTime | |
| >> Product.properties[:type].type | |
| => #<Class:0x5cf2ec> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # auto_validate.rb | |
| require "dm-types" # not sure of that... | |
| if property.type.ancestors.include?(Types::Enum) | |
| validates_within property.name, options_with_message({:set => property.type.flag_map.values}, property, :within) | |
| end | |
| # auto -validate_spec | |
| describe 'for Enum properties' do | |
| require 'dm-types' # not sure if it is ok to require dm-types here | |
| before :all do |
OlderNewer