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
def method_missing(name, *args) | |
attributes = args.last.to_a.collect {|y| y = "#{y[0]}=\"#{y[1]}\"" } .join(" ") if args.size > 1 | |
puts "<#{name} #{attributes}>#{args.first}" | |
yield if block_given? | |
puts "</#{name}>" | |
end | |
html do | |
body do | |
h1 "My internal DSL" |
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
use Modern::Perl; | |
use Attribute::Memoize; | |
use Inline qw(C); | |
=cut | |
Benchmark: running memoize, nativo, nativo_memoize, normal for at least 2 CPU seconds... | |
memoize: 2.086 wallclock secs ( 2.08 usr + 0.01 sys = 2.09 CPU) @ 299315.79/s (n=625570) | |
nativo: 2.2446 wallclock secs ( 2.24 usr + 0.01 sys = 2.25 CPU) @ 3131.11/s (n=7045) | |
nativo_memoize: 2.04854 wallclock secs ( 2.05 usr + 0.00 sys = 2.05 CPU) @ 291284.88/s (n=597134) | |
normal: 2.07676 wallclock secs ( 2.06 usr + 0.00 sys = 2.06 CPU) @ 13.59/s (n=28) |
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
package Closeable; | |
use Moose::Role; | |
requires 'close'; | |
1; | |
package Connector; | |
use Moose; |
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
for i in 4 9 8 7 1 2; do | |
sleep $i && echo $i & | |
done |
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
package FileHandleProxy; | |
use base qw/FileHandle/; | |
# constructor | |
sub new { | |
my ($class, %args) = @_; | |
my $self = \%args; | |
bless $self, $class; |
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
#!/usr/bin/perl | |
use Data::Dumper; | |
use List::Util qw(reduce min); | |
use feature 'say'; | |
use Modern::Perl; | |
open (my $fh, '<', $ARGV[0]) or die $!; | |
my $i = 0; | |
my $total = readline($fh); |
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
peczenyj Dashboard Notifications 18 Account Settings Log Out New Gist My Gists Starred Gists All Gists Back to GitHub | |
peczenyj (owner) | |
Revisions | |
8ee7cd peczenyj 4 minutes ago | |
gist: 1ab7b4824f57e9543c75 | |
Description: | |
globo.com ruby erro bizarro edit | |
Private Clone URL: | |
[email protected]:1ab7b4824f57e9543c75.git | |
logfile.txt # raw |
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
/opt/railsapps/webmediaapi/shared/bundle/ruby/1.9.1/gems/mongo-1.5.2/lib/mongo/networking.rb:335: [BUG] rb_register_sigaltstack: th->altstack not initialized | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] | |
-- Control frame information ----------------------------------------------- | |
c:0089 p:---- s:0374 b:0374 l:000373 d:000373 CFUNC :read | |
c:0088 p:0027 s:0369 b:0369 l:000368 d:000368 METHOD /opt/railsapps/webmediaapi/shared/bundle/ruby/1.9.1/gems/mongo-1.5.2/lib/mongo/networking.rb:335 | |
c:0087 p:0015 s:0362 b:0362 l:001498 d:000361 BLOCK /opt/railsapps/webmediaapi/shared/bundle/ruby/1.9.1/gems/mongo-1.5.2/lib/mongo/networking.rb:316 | |
c:0086 p:0111 s:0360 b:0360 l:0015b0 d:0015b0 METHOD /opt/generic/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:68 | |
c:0085 p:0043 s:0348 b:0348 l:001498 d:001498 METHOD /opt/railsapps/webmediaapi/shared/bundle/ruby/1.9.1/gems/mongo-1.5.2/lib/mongo/networking.rb:315 |
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
# Usage: gawk -v word=some_word_to_verify -f spelling.awk [ big.txt [ big2.txt ... ]] | |
# Gawk version with 15 lines -- 04/13/2008 | |
# Author: tiago (dot) peczenyj (at) gmail (dot) com | |
# about.me/peczenyj | |
# Based on : http://norvig.com/spell-correct.html | |
function edits(w,max,candidates,list, i,j){ | |
for(i=0;i< max ;++i) ++list[substr(w,0,i) substr(w,i+2)] # deletes | |
for(i=0;i< max-1;++i) ++list[substr(w,0,i) substr(w,i+2,1) substr(w,i+1,1) substr(w,i+3)] # transposes | |
for(i=0;i< max ;++i) for(j in alpha) ++list[substr(w,0,i) alpha[j] substr(w,i+2)] # replaces | |
for(i=0;i<= max ;++i) for(j in alpha) ++list[substr(w,0,i) alpha[j] substr(w,i+1)] # inserts |
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
# Usage: gawk -f spelling2.awk file_with_words_one_per_line.txt [ big.txt [ big2.txt ... ]] | |
# Gawk version with 15 lines -- 04/13/2008 | |
# Author: tiago (dot) peczenyj (at) gmail (dot) com | |
# about.me/peczenyj | |
# Based on : http://norvig.com/spell-correct.html | |
function edits(w,max,candidates,list, i,j){ | |
for(i=0;i< max ;++i) ++list[substr(w,0,i) substr(w,i+2)] | |
for(i=0;i< max-1;++i) ++list[substr(w,0,i) substr(w,i+2,1) substr(w,i+1,1) substr(w,i+3)] | |
for(i=0;i< max ;++i) for(j in alpha) ++list[substr(w,0,i) alpha[j] substr(w,i+2)] | |
for(i=0;i<= max ;++i) for(j in alpha) ++list[substr(w,0,i) alpha[j] substr(w,i+1)] |
OlderNewer