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
| b = {"foo" => 100, "bar" => 300, "zaz" => 5} | |
| c = {"foo" => 200, "bar" => 8} | |
| a = [b, c] | |
| a.inject({}) { |memo, i| memo.merge(i) { |key, first, second| first + second } } | |
| => { | |
| "foo" => 300, | |
| "bar" => 308, |
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 install libnotify-bin | |
| # para testar | |
| # sleep 5; alert | |
| alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"' | |
| alias alert='notify-send -i /usr/share/icons/gnome/32x32/apps/gnome-terminal.png "[$?] $(alert_helper)"' |
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
| find . -name "*rb" -print | xargs grep 'Draper' |
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
| --- | |
| layout: post | |
| title: "Blog do Frelleto" | |
| author: Vagner Zampieri | |
| date: 2013-07-20 9:17:05 | |
| categories: comunicado | |
| --- | |
| O blog nasceu, fico muito feliz em anunciar isso e espero que esse seja o primeiro post de muitos. Se você quer conhecer mais o Frelleto fica ligado no blog e no [site][site]. | |
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
| pg_restore -c --username=postgres -W -d old_database ~/new_database.dump |
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
| git branch -D old_branch | |
| git push origin --delete old_branch | |
| git branch -d -r origin/old_branch |
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
| var FrelletoBlog = angular.module('FrelletoBlog', []); | |
| FrelletoBlog.filter('highlight', function () { | |
| return function (text, filter) { | |
| if (filter === '') { | |
| return text; | |
| } | |
| else { | |
| return text.replace(new RegExp(filter, 'gi'), '<span class="match">$&</span>'); | |
| } |
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
| ### Added by the Heroku Toolbelt | |
| export PATH="/usr/local/heroku/bin:$PATH" |
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
| begin | |
| require "pry" | |
| Pry.start | |
| exit | |
| rescue LoadError => e | |
| warn "=> Unable to load pry" | |
| end |
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
| array = ['1', '', '2', '', 1, nil] | |
| array.reject!(&:blank?) | |
| => [ | |
| [0] "1", | |
| [1] "2", | |
| [2] 1 | |
| ] |