Skip to content

Instantly share code, notes, and snippets.

View mdepolli's full-sized avatar

Marcelo De Polli mdepolli

  • Shore GmbH
  • Munich, Germany
View GitHub Profile
### Default script
$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%/,)$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%
### My script
$rreplace($replace($if2(%albumartist%,%artist%),...,...),\\.\$,$noop(.))/$if($if2(%originaldate%,%date%),[$left($if2(%originaldate%,%date%),4)] ,)$rreplace($replace(%album%,...,...),\\.\$,$noop(.))$if($gt(%totaldiscs%,1),\, CD $num(%discnumber%,1),)$if($gt($left(%date%,4),$left($if2(%originaldate%,%date%),4)), [Released %date%],)/$num(%tracknumber%,2) - $replace(%title%,...,...)
Verifying my Blockstack ID is secured with the address 1FaMJoHHkn1WiHDjdAwf83myWrwHY3661d https://explorer.blockstack.org/address/1FaMJoHHkn1WiHDjdAwf83myWrwHY3661d
@mdepolli
mdepolli / beatles.rb
Created November 30, 2017 00:19
Ruby para iniciantes - 29/nov/2017
john = "John Lennon"
ringo = "Ringo Starr"
paul = "Paul McCartney"
george = "George Harrison"
beatles = [john, ringo, paul, george]
sorted_beatles = beatles.sort
puts sorted_beatles

Keybase proof

I hereby claim:

  • I am mdepolli on github.
  • I am depa (https://keybase.io/depa) on keybase.
  • I have a public key ASDvqdn_0jxO4Hh6AM6EZQysE32YizCU2GdSMAngYck4Xwo

To claim this, I am signing this object:

@mdepolli
mdepolli / foo.rb
Last active December 14, 2015 08:29
b = {"foo" => 100, "bar" => 300, "zaz" => 5}
c = {"foo" => 200, "bar" => 8}
a = [b, c]
# ??? = {"foo" => 300, "bar" => 308, "zaz" = 5}
# Solução caffo 1
response = Hash.new(0)
a.each {|i| i.each {|key, val| response[key] += val} }
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@mdepolli
mdepolli / Default (Mac).sublime-keymap
Last active October 12, 2015 22:38
Sublime Text 2 user settings
[
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+\\"], "command": "reveal_in_side_bar"},
{ "keys": ["super+shift+c"],
"command": "sublime_highlight",
"args": {
"target": "clipboard",
"output_type": "rtf"
}
@mdepolli
mdepolli / Gemfile
Created September 13, 2012 16:17
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@mdepolli
mdepolli / gist:3674398
Created September 8, 2012 12:27
Titleize equivalent for pt-BR
def br_titleize(word)
humanize(underscore(word)).gsub(/(?!(?<= )(de|da|do|das|dos|d'|e|a|o)\b)(\b[a-z\u00E0-\u00FC])/) { |s| s.mb_chars.capitalize.to_s }
end
@mdepolli
mdepolli / application_helper.rb
Last active October 10, 2015 08:27
Bootstrap 2.1-compatible flash messages helper
def flash_message
types = { :notice => 'info', :success => 'success', :error => 'error', :alert => 'error' }
flash.inject("") do |sum, message|
content_tag :div, :class => "alert alert-#{types[message[0]]}" do
button_tag('&#215;'.html_safe, :type => 'button', :class => 'close', :'data-dismiss' => 'alert', :name => nil) +
message[1]
end
end
end