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 C | |
def x; "x"; end | |
end | |
module M | |
def x; '[' + super + ']'; end | |
def y; "y"; end | |
end | |
class C |
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 foo(str: "foo", num: 123456) | |
[str, num] | |
end | |
p foo(str: 'buz', num: 9) #=> ['buz', 9] | |
p foo(str: 'bar') # => ['bar', 123456] | |
p foo(num: 123) # => ['foo', 123] | |
p foo # => ['foo', 123456] | |
p foo(bar: 'buz') # => ArgumentError |
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
p [:ruby, :"2.0", :symbol, :array, :literal] | |
#=> [:ruby, :"2.0", :symbol, :array, :literal] | |
p %i(ruby 2.0 symbol array literal) | |
#=> [:ruby, :"2.0", :symbol, :array, :literal] |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>HTML escape test</title> | |
</head> | |
<body> | |
<p>This is a test.</p> | |
</body> | |
</html> |
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
#!/bin/ruby | |
require "cgi" | |
STDOUT.print CGI.escapeHTML(ARGV.size>0 ? File.read(ARGV[0]) : STDIN.read) |
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
od --skip-bytes=4 --read-bytes=8 -t fD -An teste.bin | printf "%.0f" $(tr -d ' ') |
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
od --read-bytes=4 -t d -An teste.bin | tr -d ' ' |
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 <stdio.h> | |
int main(int argc, char **argv) { | |
FILE *file; | |
int i; | |
double d; | |
file = fopen("teste.bin","rb"); | |
fread(&i,sizeof(int),1,file); | |
fread(&d,sizeof(double),1,file); | |
printf("%d\n %#f\n",i,d); |
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 <stdio.h> | |
int main(int argc, char **argv) { | |
int i = 123; | |
double d = 456789; | |
FILE *file; | |
file = fopen("teste.bin","wb"); | |
printf("gravando int com %d bytes\n",sizeof(int)); | |
fwrite(&i,sizeof(int),1,file); | |
printf("gravando double com %d bytes\n",sizeof(double)); |
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. |