Skip to content

Instantly share code, notes, and snippets.

require "uri"
require "json"
require "ostruct"
def log_hours(options)
options = OpenStruct.new options
<<-CURL
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 "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/32.0.1700.76 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; viewsNavControlctl04_ctl02_ctl06_openState="%"2520"%"2520Tasks"%"2520assigned"%"2520to"%"2520me"%"2526"%"2520Tasks"%"2520assigned"%"2520by"%"2520me"%"2526Current"%"2520to"%"2520do"%"2520for"%"2520team; __utma=6456992.24295438.1385548697.1390224203.1390300429.12; __utmb=6456992.2.10.1390300429; __utmc=6456992; __utmz=6456992
def calculate_grid(width, cols)
results = []
(0..width).each do |n|
gutter = n.to_f
col = (width - (gutter * (cols + 1))) / cols
break if col < 0
results << "col: #{col.to_i}px / gutter: #{gutter.to_i}px" if col % 1 == 0
end
results
end
function calculate_grid(width, cols){
var results = []
for(n=0;n<=width;n++){
var gutter = n
var col = (width - (gutter * (cols + 1))) / cols
if(col % 1 == 0 && col > 0) results.push("col: "+col+"px / gutter: "+gutter+"px" )
}
return results
}
function Subcategorias(options){
var _this = this;
this.options = options;
this.selected_items = [];
this.spawn();
this.set_click_event();
}
Subcategorias.prototype = {
spawn: function(){
function ChangeClassOnScroll(options){
var _this = this;
for(property in options){
this[property] = options[property];
}
this.changed = false;
window.onscroll = function(){ _this.track() }
@pedrozath
pedrozath / selecionar-multiplo.html
Created May 12, 2014 19:09
componente para múltipla seleção de arquivos (requer bootstrap)
<script src="selecionar-multiplo.js"></script>
<div class="selecionar-multiplo">
<div class="row">
<div class="form-group col-lg-12">
<h4>Selecione usuários</h4>
<input type="text" class="form-control filter-items" name="filter-items">
</div>
var element = $(ELEMENTO);
$(window).on("resize", function(){
element.css({
marginLeft: Math.round(($(window).width()-element.outerWidth())/2)+"px",
marginTop: Math.round(($(window).height()-element.outerHeight())/2)+"px"
})
});
$(window).trigger("resize");
@pedrozath
pedrozath / trees2.java
Last active August 29, 2015 14:18
trees2.java
import java.util.ArrayList;
import processing.core.*;
public class tree1 extends PApplet {
public Branch tree;
protected int max_iterations = 28;
public void setup(){
colorMode(HSB,360,100,100,100);
background(0,0,97);
float segment_width;
int lines;
ArrayList<PVector> points = new ArrayList<PVector>();
float h_distance;
void setup(){
size(1600,1200);
lines = 160;
points.add(new PVector(0,height));
points.add(new PVector(width,height));