This file contains 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
From f0af0ed80173a0a3ff0ed1316bdb09ba64b518f0 Mon Sep 17 00:00:00 2001 | |
From: Eustaquio Rangel <taq@eustaquiorangel.com> | |
Date: Thu, 21 Dec 2023 16:12:23 -0300 | |
Subject: [PATCH] Construtor | |
--- | |
test.rb | 3 +++ | |
1 file changed, 3 insertions(+) | |
diff --git a/test.rb b/test.rb |
This file contains 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
class Test | |
def initialize | |
puts 'Inicializando um teste ...' | |
end | |
end |
This file contains 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
class Test | |
end |
This file contains 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
This is a bunch of stuff relating to the localhost ip taken off bash.org. Apologies to all the non-technically minded people... | |
#60852 | |
<Numi> hey, can you guys just check a site out and tell me if it's up? | |
<Haddock> depends, what is it? | |
<Numi> just my apache server, it works for me but seems to be down for anyone else | |
<Haddock> alright, what's the address? | |
<Numi> http://127.0.0.1 | |
<Haddock> ...... | |
<Haddock> ...Yeah, it's up. |
This file contains 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
require 'active_support/string_inquirer' | |
require 'benchmark' | |
# classe | |
class ClientExternalData | |
# o método com o inquirer/method_missing | |
def identifier | |
ActiveSupport::StringInquirer.new('uuid') | |
end |
This file contains 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
From http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/, with access forbidden right now: | |
Apple obligingly allows you to browse and download the open source software they use in OS X. Since they have listings for each version of OS X, I decided to take a look at how much software they were using that was only available under the GNU public license. The results are illuminating: | |
10.5: 47 GPL-licensed packages. | |
10.6: 44 GPL-licensed packages. | |
10.7: 29 GPL-licensed packages. | |
This clearly supports the idea that Apple is aggressively trying to remove all GPL-licensed software from OS X. While the removal of Samba and GCC got some attention, the numbers show that there’s a more general purging going on. |
This file contains 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
Just insert on .gitconfig: | |
nrb = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD):$1; }; f" | |
And then, when on a local branch and want to push to a new remote branch called, say, 'test': | |
$ git nbr test | |
Total 0 (delta 0), reused 0 (delta 0) | |
To <your remote here> | |
* [new branch] work -> test |
This file contains 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 AbstractInterface | |
class NotImplementedError < StandardError | |
def initialize(*methods) | |
super "You must implement the following methods: #{methods.join(', ')}" | |
end | |
end | |
def AbstractInterface.check_methods(klass,other,methods) | |
return if other.class==Module | |
TracePoint.new(:end) do |tp| |
This file contains 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
require "benchmark" | |
include Benchmark | |
values = (0..100).to_a | |
bm(10) do |bench| | |
bench.report("regular") do | |
values.map { |x| x * 10 }.select { |x| x > 30 } | |
end | |
bench.report("lazy") do |
This file contains 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
natural_numbers = Enumerator.new do |yielder| | |
number = 1 | |
loop do | |
yielder.yield number | |
number += 1 | |
end | |
end | |
p natural_numbers.lazy.select { |n| n.odd? }.take(5).to_a # => [1, 3, 5, 7, 9] | |
p natural_numbers.lazy.map { |n| n*2 }.take(5).to_a # => [2, 4, 6, 8, 10] |
NewerOlder