Skip to content

Instantly share code, notes, and snippets.

View klauskpm's full-sized avatar
:shipit:
Making weird things useful

Klaus Kazlauskas klauskpm

:shipit:
Making weird things useful
  • Brasil
View GitHub Profile
var LOG_TAG = "ScoreKeeper";
var ScoreKeeper = {
/**
* @param {Team[]}
*/
teams: [],
init: function initF(teamAName, teamBName) {
console.log("%c INIT", "color: #FF0000; font-weight: bolder;", LOG_TAG);
function installment(value, minInstallmentValue, maxInstallmentsNumber) {
minInstallmentValue = minInstallmentValue ? minInstallmentValue : 1;
maxInstallmentsNumber = maxInstallmentsNumber ? maxInstallmentsNumber : 12;
var installments = [];
var Installment = {quantity: 0, value: 0};
var installmentsNumber = Math.floor(value / minInstallmentValue);
if (!installmentsNumber)
#! /usr/bin/python
""" PHP install script. Tested with ubuntu 12.10"""
import os
ubuntu_packs = [
"mysql-server",
"mysql-client",
"libxml2-dev",
"libicu-dev",
@klauskpm
klauskpm / data-transformer.js
Last active September 22, 2015 22:46
Transforming object datas from an Entity
Rest = function ()
{
var entitySufix = "Entity";
var dataTransformer = new DataTransformer();
this.get = function (entityName, data) {
var entity = new window[entityName + entitySufix](data);
dataTransformer.setFields(entity.fields);
dataTransformer.setHide(entity.hide);
@klauskpm
klauskpm / gulp-classes.js
Last active September 2, 2015 15:18
Building an easy way to configure future gulp files with a simples base exemple of 4 files.
/**
* Config classes which will be used at gulp-setup.
*/
module.exports = function () {
var gRoutes = require("./gulp-routes")();
function getPath(path, type)
{
if (typeof path === "undefined") {
path = "";
@klauskpm
klauskpm / simples-debug.js
Created July 2, 2015 12:44
A simple script to easily group and debug what happens in your code.
/**
* Created by klaus.machado on 25/06/2015.
*/
function SimpleDebug()
{
var labels = {
"APP": {
"color": "#000000"
},
"EXAMPLE": {
@klauskpm
klauskpm / jquery-attrs.js
Last active August 29, 2015 14:10
Plugin to retrieve all attributes of a element
// jQuery Plugin - Loader
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
(function($) {
/**
* Plugin to retrieve all attributes of a element
* @returns {Object}
*/
$.fn.attrs = function(){
@klauskpm
klauskpm / jquery-loader.js
Last active August 29, 2015 14:10
Plugin to create an waiting page until something is done
// jQuery Plugin - Loader
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
// - Centralize >> https://gist.github.com/klauskpm/fc25fef2b4c94131d854
(function($) {
/**
* Plugin to create an waiting page until something is done
* @param {Object.<array, integer, boolean>} options Object with waiting
* texts(texts), time span between actions(interval), and the option to
@klauskpm
klauskpm / blink-cursor.css
Created November 17, 2014 15:00
Creates a simple Cursor
@klauskpm
klauskpm / jquery-centralize.js
Last active August 29, 2015 14:09
Plugin to centralize the element according to the window
// jQuery Plugin - Centralize
//
// Needs:
// - jQuery(2.1.1) >> http://code.jquery.com/jquery-2.1.1.js
(function($) {
/**
* Plugin to centralize the element according to the window
* @param {boolean} resize If true, it will resize everytime the window
* resizes
* @returns {jQuery.this}