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
@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 / 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 / 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 / notificacao.css
Created December 9, 2015 18:53
Cria notificações simples para enviar ao seu usuário. Dependências: jQuery
.notificacao {
width: 100%;
min-height: 20px;
position: fixed;
top: -1000px;
left: 0;
z-index: 250;
min-width: 250px;
}
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)
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);
/**
* Created by klauskpm
*/
(function () {
'use strict';
app
.factory('contrastService', ContrastService);
ContrastService.$inject = ['storageService'];
(function () {
var Contrast = {
storage: 'contrastState',
cssClass: 'contrast',
currentState: null,
check: checkContrast,
getState: getContrastState,
setState: setContrastState,
toogle: toogleContrast,
updateView: updateViewContrast
@klauskpm
klauskpm / without-barrel.js
Last active April 28, 2018 14:16
example of bad exports
import FooComponent from 'your-module/components/foo';
import BarComponent from 'your-module/components/bar';
import FooBarComponent from 'your-module/components/foo-bar';
@klauskpm
klauskpm / with-barrel.js
Last active April 28, 2018 14:15
Example of a good export
import { FooComponent, BarComponent, FooBarComponent } from 'your-module';