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 'net/http' | |
require 'net/https' | |
@user = 'user@email.com' | |
@pass = 'password' | |
@google = Net::HTTP.new 'www.google.com', 443 | |
@google.use_ssl = true | |
@google.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
auth = @google.get("/accounts/ClientLogin?Email=#{@user}&Passwd=#{@pass}&service=orkut").body.split("\n")[2].gsub('Auth', 'auth') |
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 'rubygems' | |
require 'sinatra' | |
get '/' do '<h1>Olá!</h1>' end | |
get '/usuarios' do '<h2>Usuários</h2><p>Aparecerá uma lista aqui.</p>' end | |
get '/usuarios/:nome' do "<p>Olá #{params[:nome]}!</p>" 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
def benchmark(benchmark_name) | |
return unless block_given? | |
initial = Time.now | |
yield | |
final = Time.now.to_f - initial.to_f | |
puts "Benchmark #{benchmark_name}: [#{final}] seconds." | |
end | |
benchmark 'Sleep Test' do | |
sleep 0.318 |
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
public static object GetPropertyValue(this object obj, string propertyName) | |
{ | |
try | |
{ | |
return obj.GetType().GetProperty(propertyName).GetValue(obj, null); | |
} | |
catch | |
{ | |
return null; | |
} |
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 'hpricot' | |
require 'open-uri' | |
html = '<html><head><title>Agora no Globo.com</title>' | |
html += '<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></head>' | |
html += '<body><h1>Agora</h1><h2>no Globo.com</h2>' | |
doc = Hpricot open('http://www.globo.com') | |
doc.search 'img' do |img| |
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
// #1 | |
$(document).ready(function() { | |
// #2 | |
$('input[type=text]').each(function() { | |
// #3 | |
var input = $(this) | |
var label = input.attr('title') | |
var foreColor = '#AAA' |
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
# | |
# Wind Wordpress Importer | |
# | |
# To install this plugin do you need copy the file to Wind plugins directory. | |
# An admin widget will be crated to import WordPress eXtended RSS file. | |
# | |
# This plugin use hurricane gem [http://github.com/danieltamiosso/hurricane], | |
# [gem install hurricane] to install it. | |
# |
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
<asp:TabPanel runat="server" ID="secondTab" HeaderText="2nd" Visible="false"> |
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
// Alterar. | |
using (var dataContext = new DatabaseContext()) | |
{ | |
var artigo = dataContext.Artigos.Find(1); | |
artigo.Title = "EF"; | |
dataContext.SaveChanges(); | |
} | |
// Remover. | |
using (var dataContext = new DatabaseContext()) |
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
var adsDivs = document.getElementsByTagName('div'); | |
for (var i = 0; i < adsDivs.length; i++) { | |
var thisDiv = adsDivs[i]; | |
var isAbsolute = thisDiv.style.position == 'absolute'; | |
if (isAbsolute) thisDiv.style.display = 'none'; | |
} |
OlderNewer