Skip to content

Instantly share code, notes, and snippets.

View kalabiyau's full-sized avatar
🐲
Breeding Dragons

Artem Chernikov kalabiyau

🐲
Breeding Dragons
  • Wildlife studios
  • Nürnberg, Germany
View GitHub Profile
@kalabiyau
kalabiyau / know_splat_difference.rb
Created March 21, 2013 09:21
If you like splat operator, you should know that you will get same object when utilizing splat to populate Array
>> [[]] * 5
=> [[], [], [], [], []]
>> _.each {|e| puts e.object_id}
19154620
19154620
19154620
19154620
19154620
=> [[], [], [], [], []]
>> [Array.new] * 5
def count(num)
"".tap do |mem|
(0..num).each do |element|
mem << element.to_s
end
end
end
-content_for :body do
%table#front_folders
[email protected]_groups_of(5, false).each do |group|
%tr
-group.each do |f|
%td
=link_to "", :remote => true, :fhref=>"#{refinery.documents_folder_path(f)}" do
.folder{:style=>get_random_grid}
%p=f.name
config.to_prepare do
# Load application's model / class decorators
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
# Load application's view overrides
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
#!/usr/bin/env ruby
class GoodMan
require 'base64'
attr_accessor :abilities, :age, :message, :skills
YODA_VOID = ["YXNrZGZrYWtzZG9vd2VvaWtsc287c2RmaWhpc2p1c2Rma2hobmtraGthbnBv\nZnk5cDItOTM0bGtodHNkZms7bDtoc2RmbA==\n",
"bGFzc2xmbHNhZGdra2xhc2R0a2x0a2w7c25hc2xkdXpqcG9hc2RmaG92\n",
"cnVieSxqUXVlcnkscGhwLHRkZCxiZGQsc2NydW0sYWdpbGUsc3FsLGxpbnV4\nLGNzcw==\n",
deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
--- no-trailing 2010-12-29 16:36:32.000000000 +0000
+++ updated 2010-12-29 16:38:24.000000000 +0000
@@ -1,4 +1,5 @@
file { "/path/to/filename":
owner => "root",
- group => "wheel"
+ group => "wheel",
+ mode => 755
}
def ApplicationController
def blah
@meme.drop!
end
end
class MemesController < ApplicationController
@kalabiyau
kalabiyau / index.haml
Created March 15, 2012 13:22
Ruby starter
%html
%title Starter
%body
%form{:action => "", :method => "post"}
%h4 Choose territory
%select{ :name => "territory" }
%option AllodsOnline_en
%option AllodsOnline_pl
%option AllodsOnline_de
%option AllodsOnline_fr
%select
%option 1
%option 2