Skip to content

Instantly share code, notes, and snippets.

View mrzasa's full-sized avatar

Maciek Rząsa mrzasa

  • Toptal
  • Rzeszów
View GitHub Profile
@mrzasa
mrzasa / gist:cf189b681d39f73cc7b4
Last active August 29, 2015 14:18
Array wrap and splat
def print3(a,b,c)
puts "a: #{a}, b: #{b}, c:#{c}"
end
a = [1,2,3]
b = Array.new(3, 1)
c = Array.new(3) {|i| i*2}
print3(*a)
@mrzasa
mrzasa / gist:624135e254d4c981f01f
Last active August 29, 2015 14:16
Hash default and symbolize
h = {}
h[:a]
h.default = 0
h[:a] += 1
h = Hash.new(0)
require 'active_support/core_ext/hash/indifferent_access'
h = {"a" => 1, "b" => 2}
h.symbolize_keys
h.with_indifferent_access[:a]
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput