Skip to content

Instantly share code, notes, and snippets.

View pedrozath's full-sized avatar

Pedro Maciel pedrozath

View GitHub Profile
@pedrozath
pedrozath / newspaper_name_generator.rb
Created October 8, 2012 14:35
Gerador de nomes de jornais
def primeiro_nome
[
"Gazeta",
"Jornal",
"Folha",
"Manchete",
"Notícia",
"Primeira",
"Diário",
"Último"
@pedrozath
pedrozath / zbrush_downloader_jquery.js
Created October 16, 2012 00:09
jquery get videos zbrush
videos = ""
lesson = document.location.href.split("/lesson/")[1]
$(".videoThumb a").each(function(i){
video_url = $(this).attr("href").split("videoname=")[1].split("&")[0]
video_name = video_url.split(lesson)[1];
curl_command = "curl -o "+ video_name + " ";
videos += curl_command + video_url + "\n";
});
console.log(videos)
@pedrozath
pedrozath / image_discipliner.js
Created October 31, 2012 22:03
image discipliner
// ---------------------------------
// I M A G E D I S C I P L I N E R
// ---------------------------------
(function($){
$.fn.imageDiscipline = function(){
var obj = $(this);
var me = this;
var specified_width = 100;
colors=["red", "blue", "yellow"];
var x = 0;
(change_color = function(){
x++;
$("body").css("background-color", colors[(x % colors.length)]);
console.log(x, (x % colors.length), colors[(x % colors.length)]);
setTimeout("change_color()", 10);
}).call(this);
@pedrozath
pedrozath / calcula_precos.rb
Created November 6, 2012 19:10
Calculo Preços Mandic
require "json"
@descontos = {
trimestral: 5.0/100,
semestral: 10.0/100,
anual: 15.0/100,
}
def descontar(preco, periodo)
(preco*(1-@descontos[periodo]))/2
end
$.fn.load_feature_content = function(obj, contents) {
var feature, feature_content;
contents.hide();
var items = ["active", "before-active", "after-active"];
for(i in items){
var item = items[i];
this.parent().find("."+item).removeClass(item);
}
this.addClass("active");
this.next().addClass("after-active");
@pedrozath
pedrozath / connect.js
Created November 14, 2012 19:51
mconnect
var connect = window.connect = new function(){
this.block = false;
this.init = function(){
window.setInterval(connect.animateArrow, 300);
$("#openhaus_connect .title, .open-connect").click(connect.open);
$("#openhaus_connect .title a, .btn-frame").click(connect.tab);
$("#black_bg_transparent").click(connect.hide);
$("#frame-form").submit(connect.sendForm);
},
this.isOpen = function(){
body
& > header
// estilo do topo
& > section
// estilo do conteúdo
& > footer
// estilo do rodapé
@pedrozath
pedrozath / log_hours.rb
Created December 16, 2013 13:12
it logs hours into comindwork
def log_hours(day)
month = 12
<<-COMMAND
curl "http://entrue.comindwork.com/Ajax/AjaxUpdateGw.aspx/DynamicList/SaveAjaxHandler" -H "Pragma: no-cache" -H "Origin: http://entrue.comindwork.com" -H "Accept-Encoding: gzip,deflate,sdch" -H "Host: entrue.comindwork.com" -H "Accept-Language: pt-BR,en-US;q=0.8,en;q=0.6" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "Cache-Control: no-cache" -H "X-Requested-With: XMLHttpRequest" -H "Cookie: XCMWSERV=z4; ASP.NET_SessionId=c5hbibn3jj2o5tvtq4cgda45; __utma=6456992.24295438.1385548697.1386586882.1386936026.5; __utmc=6456992; __utmz=6456992.1385548697.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); .auth=53412BE84134AFBD304DD9A7B289A13341D285ED434FF2642DBDAE958CD55DCEA28FF4ACCE60B64F7E145F851176C9945637BDEE22F1CC0CA803ED183225F695E67DEB4AA616FCA47F1FAFCA81B7B52C3226
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>hiperativo.co</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>