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
filename = "db/rrd/tanque-2-18.rrd" | |
rrd_version = "0003" | |
step = 1 | |
last_update = 1297711771 | |
header_size = 2228 | |
ds[reading].index = 0 | |
ds[reading].type = "GAUGE" | |
ds[reading].minimal_heartbeat = 3 | |
ds[reading].min = -8.2906880000e+06 | |
ds[reading].max = 8.2906870000e+06 |
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
(define (pick-random n) | |
"Retorna um inteiro randômico entre 1 e n-1" | |
(+ 1 (random (- n 1)))) | |
;; quanto maior a tolerância, maior a certeza de que o número | |
;; é realmente um primo, e não um primo composto. Porém o tempo | |
;; do algoritmo é proporcional à tolerância, então 10 é um número | |
;; razoável | |
(define tolerancia 10) |
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
#include <setjmp.h> | |
#include <stdio.h> | |
int | |
main(int argc, char *argv[]) | |
{ | |
jmp_buf jump; | |
int status = setjmp(jump); | |
puts("yes"); | |
longjmp(jump, status); |
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 Score | |
class << self | |
def score(choice, query) | |
return 1.0 if query.length == 0 | |
return 0.0 if choice.length == 0 | |
choice = choice.downcase | |
query = query.downcase | |
match_length = compute_match_length(choice, query.each_char.to_a) |
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
struct bar { | |
char* name; | |
int age; | |
}; | |
struct bar bars[] = { | |
{"Narciso", 25}, | |
{"Salsa", 25} | |
} |
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
img { | |
color: red; | |
test-foo: bar; | |
line-height: 1.2em; | |
} |
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
def main_domain_url site | |
URI::Generic.build scheme: request.scheme, | |
host: site.address, | |
port: request.port, | |
path: '/' | |
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
File.open("foo", "w+") {|f| f.puts "bar"} | |
File.open("foo", "w+") {|f| f.read } #=> queria "bar", mas retorna "" | |
# API que eu quero | |
resolver.with_file do |file| | |
file.write 'bar' | |
end # => 3 |
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 'irb/completion' | |
def vi | |
require 'tempfile' unless defined? Tempfile | |
@f ||= Tempfile.new('irb-interactive') | |
system('vim', @f.path) | |
Object.class_eval File.read(@f.path) if $?.success? | |
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
require 'delegate' | |
class User | |
end | |
class UserDecorator | |
def initialize(user) | |
@user = user | |
end | |
end |
OlderNewer