Skip to content

Instantly share code, notes, and snippets.

View valterbarros's full-sized avatar
👊
Code makes me happy

Valter Barros valterbarros

👊
Code makes me happy
View GitHub Profile
window.onscroll = function(ev) {
if ((document.defaultView.innerHeight + document.defaultView.scrollY) == document.body.scrollHeight) {
$('.item.number.active').next('.item').find('a').get(0).click()
}
};
require 'pp'
$group_management = []
class CalculateValue
attr_reader :totalValueOfFriendship
def initialize(friendshipsLookupTable)
@friendshipsLookupTable = friendshipsLookupTable
@additionalLinks = 0
@valterbarros
valterbarros / Observer object
Created August 23, 2018 14:07
A feature that know lives only in my mind not in my company production
function update_total(data) {
data.total = data.value * data.quantity
}
var registryProxy
// Go through each of our data properties
registry_observer = function(data) {
track_keys = ['value', 'quantity']
track_keys.forEach(function(key) {
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'normalize.css/normalize.css'
import Vue from 'vue'
import App from './App'
import './assets/basic_styles.css'
import lang from 'element-ui/lib/locale/lang/en'
import locale from 'element-ui/lib/locale'
import { Checkbox, Collapse, CollapseItem, Button, Input, Form, FormItem, Slider, Select, Option } from 'element-ui'
import router from './router'
class ApplicationController; end
module Planning; end
class PlanningContoller < ApplicationController
def index
Planning::Index.new(planning_params).run do |parameters|
create_planning(parameters)
render :index, status: 200
end
end
def calculate_scheduled_for_the_month
sum = 0.0
return sum if @planning.empty?
where_for_planning = clause_where_for_planning
i = 0
@planning.where(where_for_planning).each do |p|
p.preenchimentos.each_with_index do |obj, index|
obj.dth_inicio = Time.now - index.days
obj.dth_fim = Time.now + index.days
class Days
attr_reader :day, :fck_tests
def initialize(day, fck_tests = [])
@day = day
@fck_tests = fck_tests
end
end
class DaysBuilder
include ::Injections
register_injections ConstructionSiteStatus: %I[repo manager_creator]
module Injections
module ConstructionSiteStatus
def provide_construction_site_status_repo
@construction_site_status_repo ||= Repositories::Obras:: \
ConstructionSiteStatus::DelegateRepository.new
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int idades[0];
void definir_tamanho_vetor(int tamanho){
idades[tamanho];
}
@valterbarros
valterbarros / phyton
Created October 24, 2017 05:26
Backtracking algorithm
e = [60, 60, 60, 60, 60, 45, 45, 45, 45, 45, 45, 30, 30, 30, 30, 30, 30, 30, 5]
def bt(data, limit, m=[]):
data_sum = sum(m)
print(m)
# solution found
if data_sum == limit:
return (data, m)
# we passed the limit, so no need to check further
elif data_sum > limit: