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/ruby | |
# Exemplo tirado de http://www.tutorialspoint.com/ruby/ruby_multithreading.htm | |
def func1 | |
i=0 | |
while i<=2 | |
sleep(2) | |
puts "func1 at: #{Time.now}" | |
i=i+1 | |
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
#!/usr/bin/ruby | |
class Pessoa | |
def initialize(nome) | |
@nome = nome | |
end | |
# "getter" | |
def nome | |
@nome |
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
<center> | |
<h1>Caracteres UTF-8 Jogos</h1> | |
<h2>Xadrez</h2> | |
♔ | |
♕ | |
♖ | |
♗ | |
♘ | |
♙ |
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
/** | |
* Executar usando o PhantomJs. | |
*/ | |
var page = require('webpage').create(); | |
var url = 'http://www.gerardocumentos.com.br/?pg=gerador-de-cep'; | |
var fs = require('fs'); | |
var fileName = 'ceps.txt'; | |
var ceps = ""; | |
var qtd = 200; |
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
from subprocess import call | |
import random | |
random.seed() | |
cyclesCount = 0 | |
cyclesToCreateNewInstance = 9999 | |
sentence = "All work and no play makes Jack a dull boy" | |
def createNewInstance(): | |
call(["gnome-terminal", "-x", "python", "dull-boy.py"]) |
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
<html> | |
<head> | |
<style> | |
/*o.v. | |
big shout out to http://www.jakpsatweb.cz/css/css-vertical-center-solution.html */ | |
.container {display: table; height: 100%; position:absolute; overflow: hidden;width:100%;} | |
.helper {#position: absolute; #top: 50%;display: table-cell; vertical-align: middle;} | |
.content {#position: relative; #top: -50%;margin:0 auto;width:200px;border:1px solid orange;} |
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/python | |
import fileinput | |
for line in fileinput.input(): | |
print "hello" + line |
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 | |
while(<STDIN>){ # Puts each line at $_ , which can be used in the loop. | |
chomp; #Implicitly uses $_, if no parameter is specified. | |
print "hello $_\n"; # Uses $_ explicitly in a string. | |
} | |
## It is possible to do a fast little trick on the command line: | |
# perl -pe '#Transform $_#' | |
## -n : surround you code with 'while (<>) { #your code# }' . |
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 | |
## Example from http://langref.org/all-languages/strings/reversing-a-string/simple-substitution-cipher | |
sub rot13 { | |
my $str = shift; | |
$str =~ tr/A-Za-z/N-ZA-Mn-za-m/; | |
return $str; | |
} | |
sub rot47 { |
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
// PhantomJS script for rendering a page to an image. | |
// Author: Lucas Possatti | |
// Require system to get the command line arguments. | |
var system = require('system'); | |
// Verify if the program received the proper arguments. And warns the user | |
// if necessary. | |
if (system.args.length != 3) { | |
console.log('Usage: phantomjs picturize.js page_url image_path'); |
OlderNewer